# llama-cpp bash-completion

_comp_cmd_llama_batched()
{
    local curr prev opts
    COMPREPLY=()
    curr="${COMP_WORDS[COMP_CWORD]}"
    prev="${COMP_WORDS[COMP_CWORD-1]}"

    opts="
        -h --help --usage
        --version
        -cl --cache-list
        --completion-bash
        -t --threads
        -tb --threads-batch
        -C --cpu-mask
        -Cr --cpu-range
        --cpu-strict
        --prio
        --poll
        -Cb --cpu-mask-batch
        -Crb --cpu-range-batch
        --cpu-strict-batch
        --prio-batch
        --poll-batch
        -c --ctx-size
        -n --predict --n-predict
        -b --batch-size
        -ub --ubatch-size
        --keep
        --swa-full
        -fa --flash-attn
        -p --prompt
        --perf
        -f --file
        -bf --binary-file
        -e --escape
        --rope-scaling
        --rope-scale
        --rope-freq-base
        --rope-freq-scale
        --yarn-orig-ctx
        --yarn-ext-factor
        --yarn-attn-factor
        --yarn-beta-slow
        --yarn-beta-fast
        -kvo --kv-offload
        --repack
        --no-host
        -ctk --cache-type-k
        -ctv --cache-type-v
        -dt --defrag-thold
        -np --parallel
        --rpc
        -lm --load-mode
        -lzm --lazy-mode
        --numa
        -dev --device
        --list-devices
        -ot --override-tensor
        -cmoe --cpu-moe
        -ncmoe --n-cpu-moe
        --moe-cache-mib
        -ncffn --n-cpu-ffn
        -ngl --gpu-layers --n-gpu-layers
        -sm --split-mode
        -ts --tensor-split
        -mg --main-gpu
        -fit --fit
        -fitt --fit-target
        -fitc --fit-ctx
        --check-tensors
        --override-kv
        --op-offload
        --lora
        --lora-scaled
        --control-vector
        --control-vector-scaled
        --control-vector-layer-range
        -m --model
        -mu --model-url
        -dr --docker-repo
        -hf -hfr --hf-repo
        -hff --hf-file
        -hft --hf-token
        --log-disable
        --log-file
        --log-jsonl
        --log-colors
        -v --verbose --log-verbose
        --offline
        -lv --verbosity --log-verbosity
        --log-prefix
        --log-timestamps
        --spec-draft-type-k -ctkd --cache-type-k-draft
        --spec-draft-type-v -ctvd --cache-type-v-draft
        --samplers
        -s --seed
        --sampler-seq --sampling-seq
        --ignore-eos
        --temp --temperature
        --top-k
        --top-p
        --min-p
        --top-nsigma --top-n-sigma
        --xtc-probability
        --xtc-threshold
        --typical --typical-p
        --repeat-last-n
        --repeat-penalty
        --presence-penalty
        --frequency-penalty
        --dry-multiplier
        --dry-base
        --dry-allowed-length
        --dry-penalty-last-n
        --dry-sequence-breaker
        --adaptive-target
        --adaptive-decay
        --dynatemp-range
        --dynatemp-exp
        --mirostat
        --mirostat-lr
        --mirostat-ent
        -l --logit-bias
        --grammar
        --grammar-file
        -j --json-schema
        -jf --json-schema-file
        -bs --backend-sampling
        -kvu --kv-unified
    "

    case "$prev" in
        -h | --help | --usage )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print usage and exit"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --version )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
show version and build info"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -cl | --cache-list )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
show list of models in cache"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --completion-bash )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print source-able bash completion script for llama.cpp"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -t | --threads )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of CPU threads to use during generation (default: -1)
(env: LLAMA_ARG_THREADS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -tb | --threads-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of threads to use during batch and prompt processing (default: same as --threads)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -C | --cpu-mask )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
CPU affinity mask: arbitrarily long hex. Complements cpu-range (default: \"\")"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Cr | --cpu-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
range of CPUs for affinity. Complements --cpu-mask"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --cpu-strict )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use strict CPU placement (default: 0)
"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --prio )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set process/thread priority : low(-1), normal(0), medium(1), high(2), realtime(3) (default: 0)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --poll )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use polling level to wait for work (0 - no polling, default: 50)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Cb | --cpu-mask-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
CPU affinity mask: arbitrarily long hex. Complements cpu-range-batch (default: same as --cpu-mask)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Crb | --cpu-range-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ranges of CPUs for affinity. Complements --cpu-mask-batch"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --cpu-strict-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use strict CPU placement (default: same as --cpu-strict)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --prio-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set process/thread priority : 0-normal, 1-medium, 2-high, 3-realtime (default: 0)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --poll-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use polling to wait for work (default: same as --poll)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        -c | --ctx-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
size of the prompt context (default: 0, 0 = loaded from model)
(env: LLAMA_ARG_CTX_SIZE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -n | --predict | --n-predict )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of tokens to predict (default: 32, -1 = infinity)
(env: LLAMA_ARG_N_PREDICT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -b | --batch-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
logical maximum batch size (default: 2048)
(env: LLAMA_ARG_BATCH)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ub | --ubatch-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
physical maximum batch size (default: 512)
(env: LLAMA_ARG_UBATCH)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --keep )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of tokens to keep from the initial prompt (default: 0, -1 = all)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --swa-full )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fa | --flash-attn )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
set Flash Attention use ('on', 'off', or 'auto', default: 'auto')
(env: LLAMA_ARG_FLASH_ATTN)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        -p | --prompt )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
prompt to start generation with; for system message, use -sys"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --perf )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable internal libllama performance timings (default: false)
(env: LLAMA_ARG_PERF)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -f | --file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
a file containing the prompt (default: none)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -bf | --binary-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
binary file containing the prompt (default: none)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -e | --escape )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to process escapes sequences (\\n, \\r, \\t, \\', \\\", \\\\) (default: true)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-scaling )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
RoPE frequency scaling method, defaults to linear unless specified by the model
(env: LLAMA_ARG_ROPE_SCALING_TYPE)"
            fi
            COMPREPLY=( $(compgen -W 'none linear yarn' -- "$cur") )
            return 0
        ;;
        --rope-scale )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE context scaling factor, expands context by a factor of N
(env: LLAMA_ARG_ROPE_SCALE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-freq-base )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE base frequency, used by NTK-aware scaling (default: loaded from model)
(env: LLAMA_ARG_ROPE_FREQ_BASE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-freq-scale )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE frequency scaling factor, expands context by a factor of 1/N
(env: LLAMA_ARG_ROPE_FREQ_SCALE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-orig-ctx )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: original context size of model (default: 0 = model training context size)
(env: LLAMA_ARG_YARN_ORIG_CTX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-ext-factor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: extrapolation mix factor (default: -1.00, 0.0 = full interpolation)
(env: LLAMA_ARG_YARN_EXT_FACTOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-attn-factor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: scale sqrt(t) or attention magnitude (default: -1.00)
(env: LLAMA_ARG_YARN_ATTN_FACTOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-beta-slow )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: high correction dim or alpha (default: -1.00)
(env: LLAMA_ARG_YARN_BETA_SLOW)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-beta-fast )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: low correction dim or beta (default: -1.00)
(env: LLAMA_ARG_YARN_BETA_FAST)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -kvo | --kv-offload )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable KV cache offloading (default: enabled)
(env: LLAMA_ARG_KV_OFFLOAD)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repack )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable weight repacking (default: enabled)
(env: LLAMA_ARG_REPACK)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --no-host )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
bypass host buffer allowing extra buffers to be used
(env: LLAMA_ARG_NO_HOST)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ctk | --cache-type-k )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ctv | --cache-type-v )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -dt | --defrag-thold )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
KV cache defragmentation threshold (DEPRECATED)
(env: LLAMA_ARG_DEFRAG_THOLD)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -np | --parallel )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of parallel sequences to decode (default: 1)
(env: LLAMA_ARG_N_PARALLEL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rpc )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
comma-separated list of RPC servers (host:port)
(env: LLAMA_ARG_RPC)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -lm | --load-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
model loading mode (default: auto)
- 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)"
            fi
            COMPREPLY=( $(compgen -W 'auto none mmap mlock mmap+mlock dio' -- "$cur") )
            return 0
        ;;
        -lzm | --lazy-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
on-demand reading of certain tensors, for example per-layer embeddings (default: auto)
- on: read the rows of such tensors from disk on demand instead of keeping them resident (requires mmap)
- auto: on, but only for tensors larger than 4 GiB
- off: always keep them resident
(env: LLAMA_ARG_LAZY_MODE)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        --numa )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
attempt optimizations that help on some NUMA systems
- 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)"
            fi
            COMPREPLY=( $(compgen -W 'distribute isolate numactl' -- "$cur") )
            return 0
        ;;
        -dev | --device )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --list-devices )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print list of available devices and exit"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ot | --override-tensor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
override tensor buffer type
(env: LLAMA_ARG_OVERRIDE_TENSOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -cmoe | --cpu-moe )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep all Mixture of Experts (MoE) weights in the CPU
(env: LLAMA_ARG_CPU_MOE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ncmoe | --n-cpu-moe )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep the Mixture of Experts (MoE) weights of the first N layers in the CPU
(env: LLAMA_ARG_N_CPU_MOE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --moe-cache-mib )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
GPU cache size in MiB for the MoE experts kept in the CPU. with multiple GPUs, it is split among them like the layers (--tensor-split) (default: 0, disabled)
(env: LLAMA_ARG_MOE_CACHE_MIB)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ncffn | --n-cpu-ffn )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep the dense FFN weights of the first N layers in the CPU
(dense models; for MoE expert weights use --n-cpu-moe)
(env: LLAMA_ARG_N_CPU_FFN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ngl | --gpu-layers | --n-gpu-layers )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
max. number of layers to store in VRAM, either an exact number, 'auto', or 'all' (default: auto)
(env: LLAMA_ARG_N_GPU_LAYERS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -sm | --split-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
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)"
            fi
            COMPREPLY=( $(compgen -W 'none layer row split' -- "$cur") )
            return 0
        ;;
        -ts | --tensor-split )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
fraction of the model to offload to each GPU, comma-separated list of proportions, e.g. 3,1
(env: LLAMA_ARG_TENSOR_SPLIT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -mg | --main-gpu )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fit | --fit )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
whether to adjust unset arguments to fit in device memory ('on' or 'off', default: 'on')
(env: LLAMA_ARG_FIT)"
            fi
            COMPREPLY=( $(compgen -W 'on off' -- "$cur") )
            return 0
        ;;
        -fitt | --fit-target )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fitc | --fit-ctx )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
minimum ctx size that can be set by --fit option, default: 4096
(env: LLAMA_ARG_FIT_CTX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --check-tensors )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
check model tensor data for invalid values (default: false)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --override-kv )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --op-offload )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to offload host tensor operations to device (default: true)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --lora )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to LoRA adapter (use comma-separated values to load multiple adapters)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --lora-scaled )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to LoRA adapter with user defined scaling (format: FNAME:SCALE,...)
note: use comma-separated values"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add a control vector
note: use comma-separated values to add multiple control vectors"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector-scaled )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add a control vector with user defined scaling SCALE
note: use comma-separated values (format: FNAME:SCALE,...)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector-layer-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
layer range to apply the control vector(s) to, start and end inclusive"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -m | --model )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
model path to load
(env: LLAMA_ARG_MODEL)"
            fi
            COMPREPLY=( $(compgen -f -X '!*.gguf' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -mu | --model-url )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
model download url (default: unused)
(env: LLAMA_ARG_MODEL_URL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -dr | --docker-repo )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Docker Hub model repository. repo is optional, default to ai/. quant is optional, default to :latest.
example: gemma3
(default: unused)
(env: LLAMA_ARG_DOCKER_REPO)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hf | -hfr | --hf-repo )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face model repository; quant is optional, case-insensitive, default to Q4_K_M, or falls back to the first file in the repo if Q4_K_M doesn't exist.
mmproj is also downloaded automatically if available. to disable, add --no-mmproj
example: ggml-org/GLM-4.7-Flash-GGUF:Q4_K_M
(default: unused)
(env: LLAMA_ARG_HF_REPO)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hff | --hf-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face model file. If specified, it will override the quant in --hf-repo (default: unused)
(env: LLAMA_ARG_HF_FILE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hft | --hf-token )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face access token (default: value from HF_TOKEN environment variable)
(env: HF_TOKEN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-disable )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log disable"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log to file
(env: LLAMA_ARG_LOG_FILE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-jsonl )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log as JSONL (one JSON object per line) to stdout, this also disables colored logging (default: disabled)
(env: LLAMA_ARG_LOG_JSONL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-colors )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
Set colored logging ('on', 'off', or 'auto', default: 'auto')
'auto' enables colors when output is to a terminal
(env: LLAMA_ARG_LOG_COLORS)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        -v | --verbose | --log-verbose )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Set verbosity level to infinity (i.e. log all messages, useful for debugging)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --offline )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Offline mode: forces use of cache, prevents network access
(env: LLAMA_ARG_OFFLINE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -lv | --verbosity | --log-verbosity )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Set the verbosity threshold. Messages with a higher verbosity will be ignored. Values:
 - 0: generic output
 - 1: error
 - 2: warning
 - 3: info
 - 4: trace (more info)
 - 5: debug
(default: 3)

(env: LLAMA_ARG_LOG_VERBOSITY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-prefix )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Enable prefix in log messages
(env: LLAMA_ARG_LOG_PREFIX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-timestamps )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Enable timestamps in log messages
(env: LLAMA_ARG_LOG_TIMESTAMPS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-type-k | -ctkd | --cache-type-k-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-type-v | -ctvd | --cache-type-v-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
KV cache data type for V 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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --samplers )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
samplers that will be used for generation in the order, separated by ';'
(default: penalties;dry;top_n_sigma;top_k;typ_p;top_p;min_p;xtc;temperature)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -s | --seed )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RNG seed (default: -1, use random seed for -1)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --sampler-seq | --sampling-seq )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
simplified sequence for samplers that will be used (default: edskypmxt)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --ignore-eos )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ignore end of stream token and continue generating (implies --logit-bias EOS-inf)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --temp | --temperature )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
temperature (default: 0.80)
(env: LLAMA_ARG_TEMPERATURE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-k )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-k sampling (default: 40, 0 = disabled)
(env: LLAMA_ARG_TOP_K)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-p sampling (default: 0.95, 1.0 = disabled)
(env: LLAMA_ARG_TOP_P)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --min-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
min-p sampling (default: 0.05, 0.0 = disabled)
(env: LLAMA_ARG_MIN_P)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-nsigma | --top-n-sigma )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-n-sigma sampling (default: -1.00, -1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --xtc-probability )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
xtc probability (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --xtc-threshold )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
xtc threshold (default: 0.10, 1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --typical | --typical-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
locally typical sampling, parameter p (default: 1.00, 1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repeat-last-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
last n tokens to consider for penalize (default: 64, 0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repeat-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
penalize repeat sequence of tokens (default: 1.00, 1.0 = disabled)
(env: LLAMA_ARG_REPEAT_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --presence-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
repeat alpha presence penalty (default: 0.00, 0.0 = disabled)
(env: LLAMA_ARG_PRESENCE_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --frequency-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
repeat alpha frequency penalty (default: 0.00, 0.0 = disabled)
(env: LLAMA_ARG_FREQUENCY_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-multiplier )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY sampling multiplier (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-base )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY sampling base value (default: 1.75)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-allowed-length )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set allowed length for DRY sampling (default: 2)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-penalty-last-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY penalty for the last n tokens (default: 64, 0 = disable)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-sequence-breaker )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add sequence breaker for DRY sampling, clearing out default breakers ('\\n', ':', '\"', '*') in the process; use \"none\" to not use any sequence breakers
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --adaptive-target )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
adaptive-p: select tokens near this probability (valid range 0.0 to 1.0; negative = disabled) (default: -1.00)
[(more info)](https://github.com/ggml-org/llama.cpp/pull/17927)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --adaptive-decay )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
adaptive-p: 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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dynatemp-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
dynamic temperature range (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dynatemp-exp )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
dynamic temperature exponent (default: 1.00)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use Mirostat sampling.
Top K, Nucleus and Locally Typical samplers are ignored if used.
(default: 0, 0 = disabled, 1 = Mirostat, 2 = Mirostat 2.0)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat-lr )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Mirostat learning rate, parameter eta (default: 0.10)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat-ent )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Mirostat target entropy, parameter tau (default: 5.00)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -l | --logit-bias )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
modifies the likelihood of token appearing in the completion,
i.e. \`--logit-bias 15043+1\` to increase likelihood of token ' Hello',
or \`--logit-bias 15043-1\` to decrease likelihood of token ' Hello'"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --grammar )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
BNF-like grammar to constrain generations (see samples in grammars/ dir)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --grammar-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
file to read grammar from"
            fi
            COMPREPLY=( $(compgen -f -X '!*.gbnf' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -j | --json-schema )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
JSON schema to constrain generations (https://json-schema.org/), e.g. \`{\"type\": \"object\"}\` for any JSON object"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -jf | --json-schema-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
File containing a JSON schema to constrain generations (https://json-schema.org/), e.g. \`{\"type\": \"object\"}\` for any JSON object"
            fi
            COMPREPLY=( $(compgen -f -X '!*.json' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -bs | --backend-sampling )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
enable backend sampling (experimental) (default: disabled)
(env: LLAMA_ARG_BACKEND_SAMPLING)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -kvu | --kv-unified )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use single unified KV buffer shared across all sequences (default: enabled if number of slots is auto)
(env: LLAMA_ARG_KV_UNIFIED)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
    esac

case "$curr" in
    -* )
        COMPREPLY=( $(compgen -W "${opts}" -- "$curr") )
        return 0
    ;;
esac
} && complete -F _comp_cmd_llama_batched llama-batched

_comp_cmd_llama_batched_bench()
{
    local curr prev opts
    COMPREPLY=()
    curr="${COMP_WORDS[COMP_CWORD]}"
    prev="${COMP_WORDS[COMP_CWORD-1]}"

    opts="
        -h --help --usage
        --version
        -cl --cache-list
        --completion-bash
        -t --threads
        -tb --threads-batch
        -C --cpu-mask
        -Cr --cpu-range
        --cpu-strict
        --prio
        --poll
        -Cb --cpu-mask-batch
        -Crb --cpu-range-batch
        --cpu-strict-batch
        --prio-batch
        --poll-batch
        -c --ctx-size
        -n --predict --n-predict
        -b --batch-size
        -ub --ubatch-size
        --keep
        --swa-full
        -fa --flash-attn
        -p --prompt
        --perf
        -f --file
        -bf --binary-file
        -e --escape
        --rope-scaling
        --rope-scale
        --rope-freq-base
        --rope-freq-scale
        --yarn-orig-ctx
        --yarn-ext-factor
        --yarn-attn-factor
        --yarn-beta-slow
        --yarn-beta-fast
        -kvo --kv-offload
        --repack
        --no-host
        -ctk --cache-type-k
        -ctv --cache-type-v
        -dt --defrag-thold
        -np --parallel
        --rpc
        -lm --load-mode
        -lzm --lazy-mode
        --numa
        -dev --device
        --list-devices
        -ot --override-tensor
        -cmoe --cpu-moe
        -ncmoe --n-cpu-moe
        --moe-cache-mib
        -ncffn --n-cpu-ffn
        -ngl --gpu-layers --n-gpu-layers
        -sm --split-mode
        -ts --tensor-split
        -mg --main-gpu
        -fit --fit
        -fitt --fit-target
        -fitc --fit-ctx
        --check-tensors
        --override-kv
        --op-offload
        --lora
        --lora-scaled
        --control-vector
        --control-vector-scaled
        --control-vector-layer-range
        -m --model
        -mu --model-url
        -dr --docker-repo
        -hf -hfr --hf-repo
        -hff --hf-file
        -hft --hf-token
        --log-disable
        --log-file
        --log-jsonl
        --log-colors
        -v --verbose --log-verbose
        --offline
        -lv --verbosity --log-verbosity
        --log-prefix
        --log-timestamps
        --spec-draft-type-k -ctkd --cache-type-k-draft
        --spec-draft-type-v -ctvd --cache-type-v-draft
        --samplers
        -s --seed
        --sampler-seq --sampling-seq
        --ignore-eos
        --temp --temperature
        --top-k
        --top-p
        --min-p
        --top-nsigma --top-n-sigma
        --xtc-probability
        --xtc-threshold
        --typical --typical-p
        --repeat-last-n
        --repeat-penalty
        --presence-penalty
        --frequency-penalty
        --dry-multiplier
        --dry-base
        --dry-allowed-length
        --dry-penalty-last-n
        --dry-sequence-breaker
        --adaptive-target
        --adaptive-decay
        --dynatemp-range
        --dynatemp-exp
        --mirostat
        --mirostat-lr
        --mirostat-ent
        -l --logit-bias
        --grammar
        --grammar-file
        -j --json-schema
        -jf --json-schema-file
        -bs --backend-sampling
        -kvu --kv-unified
        -pps
        -tgs
        -npp
        -ntg
        -npl
        --output-format
    "

    case "$prev" in
        -h | --help | --usage )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print usage and exit"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --version )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
show version and build info"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -cl | --cache-list )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
show list of models in cache"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --completion-bash )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print source-able bash completion script for llama.cpp"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -t | --threads )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of CPU threads to use during generation (default: -1)
(env: LLAMA_ARG_THREADS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -tb | --threads-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of threads to use during batch and prompt processing (default: same as --threads)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -C | --cpu-mask )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
CPU affinity mask: arbitrarily long hex. Complements cpu-range (default: \"\")"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Cr | --cpu-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
range of CPUs for affinity. Complements --cpu-mask"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --cpu-strict )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use strict CPU placement (default: 0)
"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --prio )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set process/thread priority : low(-1), normal(0), medium(1), high(2), realtime(3) (default: 0)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --poll )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use polling level to wait for work (0 - no polling, default: 50)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Cb | --cpu-mask-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
CPU affinity mask: arbitrarily long hex. Complements cpu-range-batch (default: same as --cpu-mask)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Crb | --cpu-range-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ranges of CPUs for affinity. Complements --cpu-mask-batch"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --cpu-strict-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use strict CPU placement (default: same as --cpu-strict)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --prio-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set process/thread priority : 0-normal, 1-medium, 2-high, 3-realtime (default: 0)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --poll-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use polling to wait for work (default: same as --poll)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        -c | --ctx-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
size of the prompt context (default: 0, 0 = loaded from model)
(env: LLAMA_ARG_CTX_SIZE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -n | --predict | --n-predict )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of tokens to predict (default: -1, -1 = infinity)
(env: LLAMA_ARG_N_PREDICT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -b | --batch-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
logical maximum batch size (default: 2048)
(env: LLAMA_ARG_BATCH)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ub | --ubatch-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
physical maximum batch size (default: 512)
(env: LLAMA_ARG_UBATCH)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --keep )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of tokens to keep from the initial prompt (default: 0, -1 = all)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --swa-full )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fa | --flash-attn )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
set Flash Attention use ('on', 'off', or 'auto', default: 'auto')
(env: LLAMA_ARG_FLASH_ATTN)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        -p | --prompt )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
prompt to start generation with; for system message, use -sys"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --perf )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable internal libllama performance timings (default: false)
(env: LLAMA_ARG_PERF)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -f | --file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
a file containing the prompt (default: none)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -bf | --binary-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
binary file containing the prompt (default: none)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -e | --escape )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to process escapes sequences (\\n, \\r, \\t, \\', \\\", \\\\) (default: true)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-scaling )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
RoPE frequency scaling method, defaults to linear unless specified by the model
(env: LLAMA_ARG_ROPE_SCALING_TYPE)"
            fi
            COMPREPLY=( $(compgen -W 'none linear yarn' -- "$cur") )
            return 0
        ;;
        --rope-scale )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE context scaling factor, expands context by a factor of N
(env: LLAMA_ARG_ROPE_SCALE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-freq-base )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE base frequency, used by NTK-aware scaling (default: loaded from model)
(env: LLAMA_ARG_ROPE_FREQ_BASE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-freq-scale )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE frequency scaling factor, expands context by a factor of 1/N
(env: LLAMA_ARG_ROPE_FREQ_SCALE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-orig-ctx )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: original context size of model (default: 0 = model training context size)
(env: LLAMA_ARG_YARN_ORIG_CTX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-ext-factor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: extrapolation mix factor (default: -1.00, 0.0 = full interpolation)
(env: LLAMA_ARG_YARN_EXT_FACTOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-attn-factor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: scale sqrt(t) or attention magnitude (default: -1.00)
(env: LLAMA_ARG_YARN_ATTN_FACTOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-beta-slow )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: high correction dim or alpha (default: -1.00)
(env: LLAMA_ARG_YARN_BETA_SLOW)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-beta-fast )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: low correction dim or beta (default: -1.00)
(env: LLAMA_ARG_YARN_BETA_FAST)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -kvo | --kv-offload )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable KV cache offloading (default: enabled)
(env: LLAMA_ARG_KV_OFFLOAD)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repack )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable weight repacking (default: enabled)
(env: LLAMA_ARG_REPACK)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --no-host )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
bypass host buffer allowing extra buffers to be used
(env: LLAMA_ARG_NO_HOST)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ctk | --cache-type-k )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ctv | --cache-type-v )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -dt | --defrag-thold )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
KV cache defragmentation threshold (DEPRECATED)
(env: LLAMA_ARG_DEFRAG_THOLD)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -np | --parallel )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of parallel sequences to decode (default: 1)
(env: LLAMA_ARG_N_PARALLEL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rpc )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
comma-separated list of RPC servers (host:port)
(env: LLAMA_ARG_RPC)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -lm | --load-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
model loading mode (default: auto)
- 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)"
            fi
            COMPREPLY=( $(compgen -W 'auto none mmap mlock mmap+mlock dio' -- "$cur") )
            return 0
        ;;
        -lzm | --lazy-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
on-demand reading of certain tensors, for example per-layer embeddings (default: auto)
- on: read the rows of such tensors from disk on demand instead of keeping them resident (requires mmap)
- auto: on, but only for tensors larger than 4 GiB
- off: always keep them resident
(env: LLAMA_ARG_LAZY_MODE)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        --numa )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
attempt optimizations that help on some NUMA systems
- 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)"
            fi
            COMPREPLY=( $(compgen -W 'distribute isolate numactl' -- "$cur") )
            return 0
        ;;
        -dev | --device )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --list-devices )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print list of available devices and exit"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ot | --override-tensor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
override tensor buffer type
(env: LLAMA_ARG_OVERRIDE_TENSOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -cmoe | --cpu-moe )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep all Mixture of Experts (MoE) weights in the CPU
(env: LLAMA_ARG_CPU_MOE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ncmoe | --n-cpu-moe )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep the Mixture of Experts (MoE) weights of the first N layers in the CPU
(env: LLAMA_ARG_N_CPU_MOE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --moe-cache-mib )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
GPU cache size in MiB for the MoE experts kept in the CPU. with multiple GPUs, it is split among them like the layers (--tensor-split) (default: 0, disabled)
(env: LLAMA_ARG_MOE_CACHE_MIB)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ncffn | --n-cpu-ffn )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep the dense FFN weights of the first N layers in the CPU
(dense models; for MoE expert weights use --n-cpu-moe)
(env: LLAMA_ARG_N_CPU_FFN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ngl | --gpu-layers | --n-gpu-layers )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
max. number of layers to store in VRAM, either an exact number, 'auto', or 'all' (default: auto)
(env: LLAMA_ARG_N_GPU_LAYERS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -sm | --split-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
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)"
            fi
            COMPREPLY=( $(compgen -W 'none layer row split' -- "$cur") )
            return 0
        ;;
        -ts | --tensor-split )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
fraction of the model to offload to each GPU, comma-separated list of proportions, e.g. 3,1
(env: LLAMA_ARG_TENSOR_SPLIT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -mg | --main-gpu )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fit | --fit )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
whether to adjust unset arguments to fit in device memory ('on' or 'off', default: 'on')
(env: LLAMA_ARG_FIT)"
            fi
            COMPREPLY=( $(compgen -W 'on off' -- "$cur") )
            return 0
        ;;
        -fitt | --fit-target )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fitc | --fit-ctx )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
minimum ctx size that can be set by --fit option, default: 4096
(env: LLAMA_ARG_FIT_CTX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --check-tensors )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
check model tensor data for invalid values (default: false)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --override-kv )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --op-offload )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to offload host tensor operations to device (default: true)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --lora )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to LoRA adapter (use comma-separated values to load multiple adapters)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --lora-scaled )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to LoRA adapter with user defined scaling (format: FNAME:SCALE,...)
note: use comma-separated values"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add a control vector
note: use comma-separated values to add multiple control vectors"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector-scaled )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add a control vector with user defined scaling SCALE
note: use comma-separated values (format: FNAME:SCALE,...)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector-layer-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
layer range to apply the control vector(s) to, start and end inclusive"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -m | --model )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
model path to load
(env: LLAMA_ARG_MODEL)"
            fi
            COMPREPLY=( $(compgen -f -X '!*.gguf' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -mu | --model-url )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
model download url (default: unused)
(env: LLAMA_ARG_MODEL_URL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -dr | --docker-repo )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Docker Hub model repository. repo is optional, default to ai/. quant is optional, default to :latest.
example: gemma3
(default: unused)
(env: LLAMA_ARG_DOCKER_REPO)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hf | -hfr | --hf-repo )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face model repository; quant is optional, case-insensitive, default to Q4_K_M, or falls back to the first file in the repo if Q4_K_M doesn't exist.
mmproj is also downloaded automatically if available. to disable, add --no-mmproj
example: ggml-org/GLM-4.7-Flash-GGUF:Q4_K_M
(default: unused)
(env: LLAMA_ARG_HF_REPO)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hff | --hf-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face model file. If specified, it will override the quant in --hf-repo (default: unused)
(env: LLAMA_ARG_HF_FILE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hft | --hf-token )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face access token (default: value from HF_TOKEN environment variable)
(env: HF_TOKEN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-disable )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log disable"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log to file
(env: LLAMA_ARG_LOG_FILE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-jsonl )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log as JSONL (one JSON object per line) to stdout, this also disables colored logging (default: disabled)
(env: LLAMA_ARG_LOG_JSONL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-colors )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
Set colored logging ('on', 'off', or 'auto', default: 'auto')
'auto' enables colors when output is to a terminal
(env: LLAMA_ARG_LOG_COLORS)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        -v | --verbose | --log-verbose )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Set verbosity level to infinity (i.e. log all messages, useful for debugging)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --offline )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Offline mode: forces use of cache, prevents network access
(env: LLAMA_ARG_OFFLINE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -lv | --verbosity | --log-verbosity )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Set the verbosity threshold. Messages with a higher verbosity will be ignored. Values:
 - 0: generic output
 - 1: error
 - 2: warning
 - 3: info
 - 4: trace (more info)
 - 5: debug
(default: 3)

(env: LLAMA_ARG_LOG_VERBOSITY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-prefix )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Enable prefix in log messages
(env: LLAMA_ARG_LOG_PREFIX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-timestamps )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Enable timestamps in log messages
(env: LLAMA_ARG_LOG_TIMESTAMPS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-type-k | -ctkd | --cache-type-k-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-type-v | -ctvd | --cache-type-v-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
KV cache data type for V 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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --samplers )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
samplers that will be used for generation in the order, separated by ';'
(default: penalties;dry;top_n_sigma;top_k;typ_p;top_p;min_p;xtc;temperature)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -s | --seed )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RNG seed (default: -1, use random seed for -1)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --sampler-seq | --sampling-seq )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
simplified sequence for samplers that will be used (default: edskypmxt)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --ignore-eos )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ignore end of stream token and continue generating (implies --logit-bias EOS-inf)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --temp | --temperature )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
temperature (default: 0.80)
(env: LLAMA_ARG_TEMPERATURE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-k )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-k sampling (default: 40, 0 = disabled)
(env: LLAMA_ARG_TOP_K)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-p sampling (default: 0.95, 1.0 = disabled)
(env: LLAMA_ARG_TOP_P)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --min-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
min-p sampling (default: 0.05, 0.0 = disabled)
(env: LLAMA_ARG_MIN_P)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-nsigma | --top-n-sigma )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-n-sigma sampling (default: -1.00, -1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --xtc-probability )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
xtc probability (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --xtc-threshold )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
xtc threshold (default: 0.10, 1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --typical | --typical-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
locally typical sampling, parameter p (default: 1.00, 1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repeat-last-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
last n tokens to consider for penalize (default: 64, 0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repeat-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
penalize repeat sequence of tokens (default: 1.00, 1.0 = disabled)
(env: LLAMA_ARG_REPEAT_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --presence-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
repeat alpha presence penalty (default: 0.00, 0.0 = disabled)
(env: LLAMA_ARG_PRESENCE_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --frequency-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
repeat alpha frequency penalty (default: 0.00, 0.0 = disabled)
(env: LLAMA_ARG_FREQUENCY_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-multiplier )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY sampling multiplier (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-base )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY sampling base value (default: 1.75)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-allowed-length )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set allowed length for DRY sampling (default: 2)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-penalty-last-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY penalty for the last n tokens (default: 64, 0 = disable)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-sequence-breaker )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add sequence breaker for DRY sampling, clearing out default breakers ('\\n', ':', '\"', '*') in the process; use \"none\" to not use any sequence breakers
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --adaptive-target )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
adaptive-p: select tokens near this probability (valid range 0.0 to 1.0; negative = disabled) (default: -1.00)
[(more info)](https://github.com/ggml-org/llama.cpp/pull/17927)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --adaptive-decay )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
adaptive-p: 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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dynatemp-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
dynamic temperature range (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dynatemp-exp )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
dynamic temperature exponent (default: 1.00)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use Mirostat sampling.
Top K, Nucleus and Locally Typical samplers are ignored if used.
(default: 0, 0 = disabled, 1 = Mirostat, 2 = Mirostat 2.0)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat-lr )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Mirostat learning rate, parameter eta (default: 0.10)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat-ent )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Mirostat target entropy, parameter tau (default: 5.00)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -l | --logit-bias )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
modifies the likelihood of token appearing in the completion,
i.e. \`--logit-bias 15043+1\` to increase likelihood of token ' Hello',
or \`--logit-bias 15043-1\` to decrease likelihood of token ' Hello'"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --grammar )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
BNF-like grammar to constrain generations (see samples in grammars/ dir)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --grammar-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
file to read grammar from"
            fi
            COMPREPLY=( $(compgen -f -X '!*.gbnf' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -j | --json-schema )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
JSON schema to constrain generations (https://json-schema.org/), e.g. \`{\"type\": \"object\"}\` for any JSON object"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -jf | --json-schema-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
File containing a JSON schema to constrain generations (https://json-schema.org/), e.g. \`{\"type\": \"object\"}\` for any JSON object"
            fi
            COMPREPLY=( $(compgen -f -X '!*.json' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -bs | --backend-sampling )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
enable backend sampling (experimental) (default: disabled)
(env: LLAMA_ARG_BACKEND_SAMPLING)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -kvu | --kv-unified )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use single unified KV buffer shared across all sequences (default: enabled if number of slots is auto)
(env: LLAMA_ARG_KV_UNIFIED)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -pps )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
is the prompt shared across parallel sequences (default: false)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -tgs )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
is the text generation separated across the different sequences (default: false)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -npp )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of prompt tokens"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ntg )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of text generation tokens"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -npl )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of parallel prompts"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --output-format )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
output format for batched-bench results (default: md)"
            fi
            COMPREPLY=( $(compgen -W 'md jsonl' -- "$cur") )
            return 0
        ;;
    esac

case "$curr" in
    -* )
        COMPREPLY=( $(compgen -W "${opts}" -- "$curr") )
        return 0
    ;;
esac
} && complete -F _comp_cmd_llama_batched_bench llama-batched-bench

_comp_cmd_llama_cli()
{
    local curr prev opts
    COMPREPLY=()
    curr="${COMP_WORDS[COMP_CWORD]}"
    prev="${COMP_WORDS[COMP_CWORD-1]}"

    opts="
        -h --help --usage
        --version
        -cl --cache-list
        --completion-bash
        -t --threads
        -tb --threads-batch
        -C --cpu-mask
        -Cr --cpu-range
        --cpu-strict
        --prio
        --poll
        -Cb --cpu-mask-batch
        -Crb --cpu-range-batch
        --cpu-strict-batch
        --prio-batch
        --poll-batch
        -c --ctx-size
        -n --predict --n-predict
        -b --batch-size
        -ub --ubatch-size
        --keep
        --swa-full
        -fa --flash-attn
        -p --prompt
        --perf
        -f --file
        -bf --binary-file
        -e --escape
        --rope-scaling
        --rope-scale
        --rope-freq-base
        --rope-freq-scale
        --yarn-orig-ctx
        --yarn-ext-factor
        --yarn-attn-factor
        --yarn-beta-slow
        --yarn-beta-fast
        -kvo --kv-offload
        --repack
        --no-host
        -ctk --cache-type-k
        -ctv --cache-type-v
        -dt --defrag-thold
        -np --parallel
        --rpc
        -lm --load-mode
        -lzm --lazy-mode
        --numa
        -dev --device
        --list-devices
        -ot --override-tensor
        -cmoe --cpu-moe
        -ncmoe --n-cpu-moe
        --moe-cache-mib
        -ncffn --n-cpu-ffn
        -ngl --gpu-layers --n-gpu-layers
        -sm --split-mode
        -ts --tensor-split
        -mg --main-gpu
        -fit --fit
        -fitt --fit-target
        -fitc --fit-ctx
        --check-tensors
        --override-kv
        --op-offload
        --lora
        --lora-scaled
        --control-vector
        --control-vector-scaled
        --control-vector-layer-range
        -m --model
        -mu --model-url
        -dr --docker-repo
        -hf -hfr --hf-repo
        -hff --hf-file
        -hft --hf-token
        --log-disable
        --log-file
        --log-jsonl
        --log-colors
        -v --verbose --log-verbose
        --offline
        -lv --verbosity --log-verbosity
        --log-prefix
        --log-timestamps
        --spec-draft-type-k -ctkd --cache-type-k-draft
        --spec-draft-type-v -ctvd --cache-type-v-draft
        --samplers
        -s --seed
        --sampler-seq --sampling-seq
        --ignore-eos
        --temp --temperature
        --top-k
        --top-p
        --min-p
        --top-nsigma --top-n-sigma
        --xtc-probability
        --xtc-threshold
        --typical --typical-p
        --repeat-last-n
        --repeat-penalty
        --presence-penalty
        --frequency-penalty
        --dry-multiplier
        --dry-base
        --dry-allowed-length
        --dry-penalty-last-n
        --dry-sequence-breaker
        --adaptive-target
        --adaptive-decay
        --dynatemp-range
        --dynatemp-exp
        --mirostat
        --mirostat-lr
        --mirostat-ent
        -l --logit-bias
        --grammar
        --grammar-file
        -j --json-schema
        -jf --json-schema-file
        -bs --backend-sampling
        --spec-draft-hf -hfd -hfrd --hf-repo-draft
        --spec-draft-threads -td --threads-draft
        --spec-draft-threads-batch -tbd --threads-batch-draft
        --spec-draft-cpu-mask -Cd --cpu-mask-draft
        --spec-draft-cpu-range -Crd --cpu-range-draft
        --spec-draft-cpu-strict --cpu-strict-draft
        --spec-draft-prio --prio-draft
        --spec-draft-poll --poll-draft
        --spec-draft-cpu-mask-batch -Cbd --cpu-mask-batch-draft
        --spec-draft-cpu-strict-batch --cpu-strict-batch-draft
        --spec-draft-prio-batch --prio-batch-draft
        --spec-draft-poll-batch --poll-batch-draft
        --spec-draft-override-tensor -otd --override-tensor-draft
        --spec-draft-cpu-moe -cmoed --cpu-moe-draft
        --spec-draft-n-cpu-moe --spec-draft-ncmoe -ncmoed --n-cpu-moe-draft
        --spec-draft-n-max
        --spec-draft-n-min
        --spec-draft-n-ubatch
        --spec-synth-len
        --spec-synth-rates
        --spec-draft-p-split --draft-p-split
        --spec-draft-p-min --draft-p-min
        --spec-draft-backend-sampling
        --spec-draft-sampling
        --spec-draft-device -devd --device-draft
        --spec-draft-ngl -ngld --gpu-layers-draft --n-gpu-layers-draft
        --spec-draft-model -md --model-draft
        --spec-type
        --spec-ngram-mod-n-min
        --spec-ngram-mod-n-max
        --spec-ngram-mod-n-match
        --spec-ngram-simple-size-n
        --spec-ngram-simple-size-m
        --spec-ngram-simple-min-hits
        --spec-ngram-map-k-size-n
        --spec-ngram-map-k-size-m
        --spec-ngram-map-k-min-hits
        --spec-ngram-map-k4v-size-n
        --spec-ngram-map-k4v-size-m
        --spec-ngram-map-k4v-min-hits
        --draft --draft-n --draft-max
        --draft-min --draft-n-min
        --server-base
        --verbose-prompt
        --display-prompt
        -co --color
        -ctxcp --ctx-checkpoints --swa-checkpoints
        -cram --cache-ram
        --context-shift
        -sys --system-prompt
        --show-timings
        -sysf --system-prompt-file
        -r --reverse-prompt
        -sp --special
        -st --single-turn
        -mli --multiline-input
        --warmup
        -mm --mmproj
        -mmu --mmproj-url
        --mmproj-auto
        --mmproj-offload
        -mmdev --mmproj-device
        --image --audio --video
        --image-min-tokens
        --image-max-tokens
        --video-fps
        --video-timestamp-interval
        --video-ffmpeg-dir
        -o --output --output-file
        --chat-template-kwargs
        --jinja
        --reasoning-format
        -rea --reasoning
        --reasoning-effort
        --reasoning-budget
        --reasoning-budget-message
        --reasoning-preserve
        --chat-template
        --chat-template-file
        --skip-chat-parsing
        --simple-io
        --log-prompts-dir
        --gpt-oss-20b-default
        --gpt-oss-120b-default
        --vision-gemma-4b-default
        --vision-gemma-12b-default
        --spec-default
    "

    case "$prev" in
        -h | --help | --usage )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print usage and exit"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --version )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
show version and build info"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -cl | --cache-list )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
show list of models in cache"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --completion-bash )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print source-able bash completion script for llama.cpp"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -t | --threads )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of CPU threads to use during generation (default: -1)
(env: LLAMA_ARG_THREADS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -tb | --threads-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of threads to use during batch and prompt processing (default: same as --threads)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -C | --cpu-mask )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
CPU affinity mask: arbitrarily long hex. Complements cpu-range (default: \"\")"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Cr | --cpu-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
range of CPUs for affinity. Complements --cpu-mask"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --cpu-strict )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use strict CPU placement (default: 0)
"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --prio )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set process/thread priority : low(-1), normal(0), medium(1), high(2), realtime(3) (default: 0)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --poll )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use polling level to wait for work (0 - no polling, default: 50)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Cb | --cpu-mask-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
CPU affinity mask: arbitrarily long hex. Complements cpu-range-batch (default: same as --cpu-mask)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Crb | --cpu-range-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ranges of CPUs for affinity. Complements --cpu-mask-batch"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --cpu-strict-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use strict CPU placement (default: same as --cpu-strict)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --prio-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set process/thread priority : 0-normal, 1-medium, 2-high, 3-realtime (default: 0)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --poll-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use polling to wait for work (default: same as --poll)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        -c | --ctx-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
size of the prompt context (default: 0, 0 = loaded from model)
(env: LLAMA_ARG_CTX_SIZE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -n | --predict | --n-predict )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of tokens to predict (default: -1, -1 = infinity)
(env: LLAMA_ARG_N_PREDICT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -b | --batch-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
logical maximum batch size (default: 2048)
(env: LLAMA_ARG_BATCH)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ub | --ubatch-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
physical maximum batch size (default: 512)
(env: LLAMA_ARG_UBATCH)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --keep )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of tokens to keep from the initial prompt (default: 0, -1 = all)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --swa-full )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fa | --flash-attn )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
set Flash Attention use ('on', 'off', or 'auto', default: 'auto')
(env: LLAMA_ARG_FLASH_ATTN)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        -p | --prompt )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
prompt to start generation with; for system message, use -sys"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --perf )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable internal libllama performance timings (default: false)
(env: LLAMA_ARG_PERF)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -f | --file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
a file containing the prompt (default: none)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -bf | --binary-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
binary file containing the prompt (default: none)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -e | --escape )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to process escapes sequences (\\n, \\r, \\t, \\', \\\", \\\\) (default: true)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-scaling )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
RoPE frequency scaling method, defaults to linear unless specified by the model
(env: LLAMA_ARG_ROPE_SCALING_TYPE)"
            fi
            COMPREPLY=( $(compgen -W 'none linear yarn' -- "$cur") )
            return 0
        ;;
        --rope-scale )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE context scaling factor, expands context by a factor of N
(env: LLAMA_ARG_ROPE_SCALE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-freq-base )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE base frequency, used by NTK-aware scaling (default: loaded from model)
(env: LLAMA_ARG_ROPE_FREQ_BASE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-freq-scale )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE frequency scaling factor, expands context by a factor of 1/N
(env: LLAMA_ARG_ROPE_FREQ_SCALE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-orig-ctx )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: original context size of model (default: 0 = model training context size)
(env: LLAMA_ARG_YARN_ORIG_CTX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-ext-factor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: extrapolation mix factor (default: -1.00, 0.0 = full interpolation)
(env: LLAMA_ARG_YARN_EXT_FACTOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-attn-factor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: scale sqrt(t) or attention magnitude (default: -1.00)
(env: LLAMA_ARG_YARN_ATTN_FACTOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-beta-slow )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: high correction dim or alpha (default: -1.00)
(env: LLAMA_ARG_YARN_BETA_SLOW)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-beta-fast )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: low correction dim or beta (default: -1.00)
(env: LLAMA_ARG_YARN_BETA_FAST)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -kvo | --kv-offload )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable KV cache offloading (default: enabled)
(env: LLAMA_ARG_KV_OFFLOAD)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repack )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable weight repacking (default: enabled)
(env: LLAMA_ARG_REPACK)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --no-host )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
bypass host buffer allowing extra buffers to be used
(env: LLAMA_ARG_NO_HOST)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ctk | --cache-type-k )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ctv | --cache-type-v )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -dt | --defrag-thold )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
KV cache defragmentation threshold (DEPRECATED)
(env: LLAMA_ARG_DEFRAG_THOLD)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -np | --parallel )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of parallel sequences to decode (default: 1)
(env: LLAMA_ARG_N_PARALLEL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rpc )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
comma-separated list of RPC servers (host:port)
(env: LLAMA_ARG_RPC)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -lm | --load-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
model loading mode (default: auto)
- 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)"
            fi
            COMPREPLY=( $(compgen -W 'auto none mmap mlock mmap+mlock dio' -- "$cur") )
            return 0
        ;;
        -lzm | --lazy-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
on-demand reading of certain tensors, for example per-layer embeddings (default: auto)
- on: read the rows of such tensors from disk on demand instead of keeping them resident (requires mmap)
- auto: on, but only for tensors larger than 4 GiB
- off: always keep them resident
(env: LLAMA_ARG_LAZY_MODE)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        --numa )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
attempt optimizations that help on some NUMA systems
- 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)"
            fi
            COMPREPLY=( $(compgen -W 'distribute isolate numactl' -- "$cur") )
            return 0
        ;;
        -dev | --device )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --list-devices )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print list of available devices and exit"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ot | --override-tensor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
override tensor buffer type
(env: LLAMA_ARG_OVERRIDE_TENSOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -cmoe | --cpu-moe )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep all Mixture of Experts (MoE) weights in the CPU
(env: LLAMA_ARG_CPU_MOE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ncmoe | --n-cpu-moe )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep the Mixture of Experts (MoE) weights of the first N layers in the CPU
(env: LLAMA_ARG_N_CPU_MOE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --moe-cache-mib )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
GPU cache size in MiB for the MoE experts kept in the CPU. with multiple GPUs, it is split among them like the layers (--tensor-split) (default: 0, disabled)
(env: LLAMA_ARG_MOE_CACHE_MIB)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ncffn | --n-cpu-ffn )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep the dense FFN weights of the first N layers in the CPU
(dense models; for MoE expert weights use --n-cpu-moe)
(env: LLAMA_ARG_N_CPU_FFN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ngl | --gpu-layers | --n-gpu-layers )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
max. number of layers to store in VRAM, either an exact number, 'auto', or 'all' (default: auto)
(env: LLAMA_ARG_N_GPU_LAYERS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -sm | --split-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
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)"
            fi
            COMPREPLY=( $(compgen -W 'none layer row split' -- "$cur") )
            return 0
        ;;
        -ts | --tensor-split )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
fraction of the model to offload to each GPU, comma-separated list of proportions, e.g. 3,1
(env: LLAMA_ARG_TENSOR_SPLIT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -mg | --main-gpu )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fit | --fit )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
whether to adjust unset arguments to fit in device memory ('on' or 'off', default: 'on')
(env: LLAMA_ARG_FIT)"
            fi
            COMPREPLY=( $(compgen -W 'on off' -- "$cur") )
            return 0
        ;;
        -fitt | --fit-target )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fitc | --fit-ctx )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
minimum ctx size that can be set by --fit option, default: 4096
(env: LLAMA_ARG_FIT_CTX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --check-tensors )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
check model tensor data for invalid values (default: false)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --override-kv )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --op-offload )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to offload host tensor operations to device (default: true)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --lora )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to LoRA adapter (use comma-separated values to load multiple adapters)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --lora-scaled )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to LoRA adapter with user defined scaling (format: FNAME:SCALE,...)
note: use comma-separated values"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add a control vector
note: use comma-separated values to add multiple control vectors"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector-scaled )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add a control vector with user defined scaling SCALE
note: use comma-separated values (format: FNAME:SCALE,...)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector-layer-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
layer range to apply the control vector(s) to, start and end inclusive"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -m | --model )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
model path to load
(env: LLAMA_ARG_MODEL)"
            fi
            COMPREPLY=( $(compgen -f -X '!*.gguf' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -mu | --model-url )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
model download url (default: unused)
(env: LLAMA_ARG_MODEL_URL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -dr | --docker-repo )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Docker Hub model repository. repo is optional, default to ai/. quant is optional, default to :latest.
example: gemma3
(default: unused)
(env: LLAMA_ARG_DOCKER_REPO)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hf | -hfr | --hf-repo )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face model repository; quant is optional, case-insensitive, default to Q4_K_M, or falls back to the first file in the repo if Q4_K_M doesn't exist.
mmproj is also downloaded automatically if available. to disable, add --no-mmproj
example: ggml-org/GLM-4.7-Flash-GGUF:Q4_K_M
(default: unused)
(env: LLAMA_ARG_HF_REPO)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hff | --hf-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face model file. If specified, it will override the quant in --hf-repo (default: unused)
(env: LLAMA_ARG_HF_FILE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hft | --hf-token )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face access token (default: value from HF_TOKEN environment variable)
(env: HF_TOKEN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-disable )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log disable"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log to file
(env: LLAMA_ARG_LOG_FILE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-jsonl )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log as JSONL (one JSON object per line) to stdout, this also disables colored logging (default: disabled)
(env: LLAMA_ARG_LOG_JSONL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-colors )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
Set colored logging ('on', 'off', or 'auto', default: 'auto')
'auto' enables colors when output is to a terminal
(env: LLAMA_ARG_LOG_COLORS)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        -v | --verbose | --log-verbose )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Set verbosity level to infinity (i.e. log all messages, useful for debugging)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --offline )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Offline mode: forces use of cache, prevents network access
(env: LLAMA_ARG_OFFLINE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -lv | --verbosity | --log-verbosity )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Set the verbosity threshold. Messages with a higher verbosity will be ignored. Values:
 - 0: generic output
 - 1: error
 - 2: warning
 - 3: info
 - 4: trace (more info)
 - 5: debug
(default: 1)

(env: LLAMA_ARG_LOG_VERBOSITY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-prefix )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Enable prefix in log messages
(env: LLAMA_ARG_LOG_PREFIX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-timestamps )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Enable timestamps in log messages
(env: LLAMA_ARG_LOG_TIMESTAMPS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-type-k | -ctkd | --cache-type-k-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-type-v | -ctvd | --cache-type-v-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
KV cache data type for V 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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --samplers )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
samplers that will be used for generation in the order, separated by ';'
(default: penalties;dry;top_n_sigma;top_k;typ_p;top_p;min_p;xtc;temperature)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -s | --seed )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RNG seed (default: -1, use random seed for -1)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --sampler-seq | --sampling-seq )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
simplified sequence for samplers that will be used (default: edskypmxt)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --ignore-eos )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ignore end of stream token and continue generating (implies --logit-bias EOS-inf)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --temp | --temperature )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
temperature (default: 0.80)
(env: LLAMA_ARG_TEMPERATURE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-k )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-k sampling (default: 40, 0 = disabled)
(env: LLAMA_ARG_TOP_K)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-p sampling (default: 0.95, 1.0 = disabled)
(env: LLAMA_ARG_TOP_P)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --min-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
min-p sampling (default: 0.05, 0.0 = disabled)
(env: LLAMA_ARG_MIN_P)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-nsigma | --top-n-sigma )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-n-sigma sampling (default: -1.00, -1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --xtc-probability )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
xtc probability (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --xtc-threshold )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
xtc threshold (default: 0.10, 1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --typical | --typical-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
locally typical sampling, parameter p (default: 1.00, 1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repeat-last-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
last n tokens to consider for penalize (default: 64, 0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repeat-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
penalize repeat sequence of tokens (default: 1.00, 1.0 = disabled)
(env: LLAMA_ARG_REPEAT_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --presence-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
repeat alpha presence penalty (default: 0.00, 0.0 = disabled)
(env: LLAMA_ARG_PRESENCE_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --frequency-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
repeat alpha frequency penalty (default: 0.00, 0.0 = disabled)
(env: LLAMA_ARG_FREQUENCY_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-multiplier )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY sampling multiplier (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-base )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY sampling base value (default: 1.75)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-allowed-length )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set allowed length for DRY sampling (default: 2)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-penalty-last-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY penalty for the last n tokens (default: 64, 0 = disable)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-sequence-breaker )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add sequence breaker for DRY sampling, clearing out default breakers ('\\n', ':', '\"', '*') in the process; use \"none\" to not use any sequence breakers
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --adaptive-target )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
adaptive-p: select tokens near this probability (valid range 0.0 to 1.0; negative = disabled) (default: -1.00)
[(more info)](https://github.com/ggml-org/llama.cpp/pull/17927)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --adaptive-decay )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
adaptive-p: 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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dynatemp-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
dynamic temperature range (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dynatemp-exp )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
dynamic temperature exponent (default: 1.00)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use Mirostat sampling.
Top K, Nucleus and Locally Typical samplers are ignored if used.
(default: 0, 0 = disabled, 1 = Mirostat, 2 = Mirostat 2.0)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat-lr )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Mirostat learning rate, parameter eta (default: 0.10)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat-ent )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Mirostat target entropy, parameter tau (default: 5.00)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -l | --logit-bias )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
modifies the likelihood of token appearing in the completion,
i.e. \`--logit-bias 15043+1\` to increase likelihood of token ' Hello',
or \`--logit-bias 15043-1\` to decrease likelihood of token ' Hello'"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --grammar )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
BNF-like grammar to constrain generations (see samples in grammars/ dir)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --grammar-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
file to read grammar from"
            fi
            COMPREPLY=( $(compgen -f -X '!*.gbnf' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -j | --json-schema )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
JSON schema to constrain generations (https://json-schema.org/), e.g. \`{\"type\": \"object\"}\` for any JSON object"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -jf | --json-schema-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
File containing a JSON schema to constrain generations (https://json-schema.org/), e.g. \`{\"type\": \"object\"}\` for any JSON object"
            fi
            COMPREPLY=( $(compgen -f -X '!*.json' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -bs | --backend-sampling )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
enable backend sampling (experimental) (default: disabled)
(env: LLAMA_ARG_BACKEND_SAMPLING)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-hf | -hfd | -hfrd | --hf-repo-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Same as --hf-repo, but for the draft model (default: unused)
(env: LLAMA_ARG_SPEC_DRAFT_HF_REPO)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-threads | -td | --threads-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of threads to use during generation (default: same as --threads)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-threads-batch | -tbd | --threads-batch-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of threads to use during batch and prompt processing (default: same as --threads-draft)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-cpu-mask | -Cd | --cpu-mask-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Draft model CPU affinity mask. Complements cpu-range-draft (default: same as --cpu-mask)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-cpu-range | -Crd | --cpu-range-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Ranges of CPUs for affinity. Complements --cpu-mask-draft"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-cpu-strict | --cpu-strict-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
Use strict CPU placement for draft model (default: same as --cpu-strict)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --spec-draft-prio | --prio-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set draft process/thread priority : 0-normal, 1-medium, 2-high, 3-realtime (default: 0)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-poll | --poll-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
Use polling to wait for draft model work (default: same as --poll)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --spec-draft-cpu-mask-batch | -Cbd | --cpu-mask-batch-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Draft model CPU affinity mask. Complements cpu-range-draft (default: same as --cpu-mask)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-cpu-strict-batch | --cpu-strict-batch-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
Use strict CPU placement for draft model (default: --cpu-strict-draft)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --spec-draft-prio-batch | --prio-batch-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set draft process/thread priority : 0-normal, 1-medium, 2-high, 3-realtime (default: 0)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-poll-batch | --poll-batch-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
Use polling to wait for draft model work (default: --poll-draft)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --spec-draft-override-tensor | -otd | --override-tensor-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
override tensor buffer type for draft model"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-cpu-moe | -cmoed | --cpu-moe-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep all Mixture of Experts (MoE) weights in the CPU for the draft model
(env: LLAMA_ARG_SPEC_DRAFT_CPU_MOE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-n-cpu-moe | --spec-draft-ncmoe | -ncmoed | --n-cpu-moe-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep the Mixture of Experts (MoE) weights of the first N layers in the CPU for the draft model
(env: LLAMA_ARG_SPEC_DRAFT_N_CPU_MOE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-n-max )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of tokens to draft for speculative decoding (default: 3)
(env: LLAMA_ARG_SPEC_DRAFT_N_MAX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-n-min )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
minimum number of draft tokens to use for speculative decoding (default: 0)
(env: LLAMA_ARG_SPEC_DRAFT_N_MIN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-n-ubatch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
physical maximum batch size of the draft context, use a smaller value to spare VRAM (default: 0 - same as --n-ubatch)
(env: LLAMA_ARG_SPEC_DRAFT_N_UBATCH)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-synth-len )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
target mean synthetic acceptance length, including the target token (benchmarking only)
(env: LLAMA_ARG_SPEC_SYNTH_LEN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-synth-rates )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
comma-separated unconditional per-position synthetic acceptance probabilities (benchmarking only)
(env: LLAMA_ARG_SPEC_SYNTH_RATES)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-p-split | --draft-p-split )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
speculative decoding split probability (default: 0.10)
(env: LLAMA_ARG_SPEC_DRAFT_P_SPLIT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-p-min | --draft-p-min )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
minimum speculative decoding probability (greedy) (default: 0.00)
(env: LLAMA_ARG_SPEC_DRAFT_P_MIN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-backend-sampling )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
offload draft sampling to the backend (default: enabled)
(env: LLAMA_ARG_SPEC_DRAFT_BACKEND_SAMPLING)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-sampling )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
how the draft is sampled: greedy takes its argmax, probabilistic samples it and has the target verify by rejection sampling (default: greedy)
(env: LLAMA_ARG_SPEC_DRAFT_SAMPLING)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-device | -devd | --device-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
comma-separated list of devices to use for offloading the draft model (none = don't offload, default: follows --device)
use --list-devices to see a list of available devices"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-ngl | -ngld | --gpu-layers-draft | --n-gpu-layers-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
max. number of draft model layers to store in VRAM, either an exact number, 'auto', or 'all' (default: auto)
(env: LLAMA_ARG_N_GPU_LAYERS_DRAFT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-model | -md | --model-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
draft model for speculative decoding (default: unused)
(env: LLAMA_ARG_SPEC_DRAFT_MODEL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-type )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
comma-separated list of types of speculative decoding to use (default: none)

(env: LLAMA_ARG_SPEC_TYPE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-ngram-mod-n-min )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
minimum number of ngram tokens to use for ngram-based speculative decoding (default: 48)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-ngram-mod-n-max )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
maximum number of ngram tokens to use for ngram-based speculative decoding (default: 64)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-ngram-mod-n-match )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ngram-mod lookup length (default: 24)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-ngram-simple-size-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ngram size N for ngram-simple speculative decoding, length of lookup n-gram (default: 12)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-ngram-simple-size-m )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ngram size M for ngram-simple speculative decoding, length of draft m-gram (default: 48)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-ngram-simple-min-hits )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
minimum hits for ngram-simple speculative decoding (default: 1)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-ngram-map-k-size-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ngram size N for ngram-map-k speculative decoding, length of lookup n-gram (default: 12)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-ngram-map-k-size-m )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ngram size M for ngram-map-k speculative decoding, length of draft m-gram (default: 48)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-ngram-map-k-min-hits )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
minimum hits for ngram-map-k speculative decoding (default: 1)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-ngram-map-k4v-size-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ngram size N for ngram-map-k4v speculative decoding, length of lookup n-gram (default: 12)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-ngram-map-k4v-size-m )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ngram size M for ngram-map-k4v speculative decoding, length of draft m-gram (default: 48)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-ngram-map-k4v-min-hits )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
minimum hits for ngram-map-k4v speculative decoding (default: 1)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --draft | --draft-n | --draft-max )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
the argument has been removed. use --spec-draft-n-max or --spec-ngram-mod-n-max
(env: LLAMA_ARG_DRAFT_MAX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --draft-min | --draft-n-min )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
the argument has been removed. use --spec-draft-n-min or --spec-ngram-mod-n-min
(env: LLAMA_ARG_DRAFT_MIN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --server-base )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
connect to this server instead of starting a new one, example: 'http://localhost:9931' (default: none)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --verbose-prompt )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print a verbose prompt before generation (default: false)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --display-prompt )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to print prompt at generation (default: true)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -co | --color )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
Colorize output to distinguish prompt and user input from generations ('on', 'off', or 'auto', default: 'auto')
'auto' enables colors when output is to a terminal"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        -ctxcp | --ctx-checkpoints | --swa-checkpoints )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
max number of context checkpoints to create per slot (default: 32)[(more info)](https://github.com/ggml-org/llama.cpp/pull/15293)
(env: LLAMA_ARG_CTX_CHECKPOINTS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -cram | --cache-ram )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set the maximum cache size in MiB (default: 8192, 0 for decision models, -1 - no limit, 0 - disable)[(more info)](https://github.com/ggml-org/llama.cpp/pull/16391)
(env: LLAMA_ARG_CACHE_RAM)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --context-shift )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to use context shift on infinite text generation (default: disabled)
(env: LLAMA_ARG_CONTEXT_SHIFT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -sys | --system-prompt )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
system prompt to use with model (if applicable, depending on chat template)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --show-timings )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to show timing information after each response (default: true)
(env: LLAMA_ARG_SHOW_TIMINGS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -sysf | --system-prompt-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
a file containing the system prompt (default: none)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -r | --reverse-prompt )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
halt generation at PROMPT, return control in interactive mode
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -sp | --special )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
special tokens output enabled (default: false)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -st | --single-turn )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
run conversation for a single turn only, then exit when done
will not be interactive if first turn is predefined with --prompt
(default: false)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -mli | --multiline-input )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
allows you to write or paste multiple lines without ending each in '\\'"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --warmup )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to perform warmup with an empty run (default: enabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -mm | --mmproj )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
path to a multimodal projector file. see tools/mtmd/README.md
note: if -hf is used, this argument can be omitted
(env: LLAMA_ARG_MMPROJ)"
            fi
            COMPREPLY=( $(compgen -f -X '!*.mmproj' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -mmu | --mmproj-url )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
URL to a multimodal projector file. see tools/mtmd/README.md
(env: LLAMA_ARG_MMPROJ_URL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mmproj-auto )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to use multimodal projector file (if available), useful when using -hf (default: enabled)
(env: LLAMA_ARG_MMPROJ_AUTO)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mmproj-offload )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable GPU offloading for multimodal projector (default: enabled)
(env: LLAMA_ARG_MMPROJ_OFFLOAD)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -mmdev | --mmproj-device )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
device to use for multimodal projector (none = don't offload, default: follows --device)
use --list-devices to see a list of available devices
(env: MTMD_BACKEND_DEVICE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --image | --audio | --video )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to an image, audio, or video file. use with multimodal models, use comma-separated values for multiple files
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --image-min-tokens )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
minimum number of tokens each image can take, only used by vision models with dynamic resolution (default: read from model)
(env: LLAMA_ARG_IMAGE_MIN_TOKENS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --image-max-tokens )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
maximum number of tokens each image can take, only used by vision models with dynamic resolution (default: read from model)
(env: LLAMA_ARG_IMAGE_MAX_TOKENS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --video-fps )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
target video frame rate (default: 4.0)
(env: LLAMA_ARG_VIDEO_FPS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --video-timestamp-interval )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
interval in milliseconds between text timestamps (default: 5000)
(env: LLAMA_ARG_VIDEO_TIMESTAMP_INTERVAL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --video-ffmpeg-dir )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to the directory containing ffmpeg and ffprobe (default: search in PATH)
(env: LLAMA_ARG_VIDEO_FFMPEG_DIR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -o | --output | --output-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
output file (default: '')"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --chat-template-kwargs )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
sets additional params for the json template parser, must be a valid json object string, e.g. '{\"key1\":\"value1\",\"key2\":\"value2\"}'
(env: LLAMA_ARG_CHAT_TEMPLATE_KWARGS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --jinja )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to use jinja template engine for chat (default: enabled)
(env: LLAMA_ARG_JINJA)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --reasoning-format )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
controls whether thought tags are allowed and/or extracted from the response, and in which format they're returned; one of:
- none: leaves thoughts unparsed in \`message.content\`
- deepseek: puts thoughts in \`message.reasoning_content\`
- deepseek-legacy: keeps \`<think>\` tags in \`message.content\` while also populating \`message.reasoning_content\`
(default: auto)
(env: LLAMA_ARG_THINK)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -rea | --reasoning )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Use reasoning/thinking in the chat ('on', 'off', or 'auto', default: 'auto' (detect from template))
(env: LLAMA_ARG_REASONING)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --reasoning-effort )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
reasoning effort level given to the chat template: 'default' to keep the template default,
or a level such as 'minimal', 'low', 'medium', 'high', 'xhigh' or 'max' (default: default)
(env: LLAMA_ARG_REASONING_EFFORT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --reasoning-budget )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
token budget for thinking: -1 for unrestricted, 0 for immediate end, N>0 for token budget (default: -1)
(env: LLAMA_ARG_THINK_BUDGET)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --reasoning-budget-message )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
message injected before the end-of-thinking tag when reasoning budget is exhausted (default: none)
(env: LLAMA_ARG_THINK_BUDGET_MESSAGE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --reasoning-preserve )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
preserve reasoning trace in the full history, not just the last assistant message (default: enabled)
compatible with certain templates having 'supports_preserve_reasoning' capability
example: https://docs.z.ai/guides/capabilities/thinking-mode#preserved-thinking
(env: LLAMA_ARG_REASONING_PRESERVE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --chat-template )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set custom jinja chat template (default: template taken from model's metadata)
if suffix/prefix are specified, template will be disabled
only commonly used templates are accepted (unless --jinja is set before this flag):
list of built-in templates:
bailing, bailing-think, bailing2, chatglm3, chatglm4, chatml, command-r, deepseek, deepseek-ocr, deepseek2, deepseek3, exaone-moe, exaone3, exaone4, falcon3, gemma, gigachat, glmedge, gpt-oss, granite, granite-4.0, granite-4.1, grok-2, hunyuan-dense, hunyuan-moe, hunyuan-vl, kimi-k2, llama2, llama2-sys, llama2-sys-bos, llama2-sys-strip, llama3, llama4, megrez, minicpm, mistral-v1, mistral-v3, mistral-v3-tekken, mistral-v7, mistral-v7-tekken, monarch, openchat, orion, pangu-embedded, phi3, phi4, rwkv-world, seed_oss, smolvlm, solar-open, vicuna, vicuna-orca, yandex, zephyr
(env: LLAMA_ARG_CHAT_TEMPLATE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --chat-template-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
set custom jinja chat template file (default: template taken from model's metadata)
if suffix/prefix are specified, template will be disabled
only commonly used templates are accepted (unless --jinja is set before this flag):
list of built-in templates:
bailing, bailing-think, bailing2, chatglm3, chatglm4, chatml, command-r, deepseek, deepseek-ocr, deepseek2, deepseek3, exaone-moe, exaone3, exaone4, falcon3, gemma, gigachat, glmedge, gpt-oss, granite, granite-4.0, granite-4.1, grok-2, hunyuan-dense, hunyuan-moe, hunyuan-vl, kimi-k2, llama2, llama2-sys, llama2-sys-bos, llama2-sys-strip, llama3, llama4, megrez, minicpm, mistral-v1, mistral-v3, mistral-v3-tekken, mistral-v7, mistral-v7-tekken, monarch, openchat, orion, pangu-embedded, phi3, phi4, rwkv-world, seed_oss, smolvlm, solar-open, vicuna, vicuna-orca, yandex, zephyr
(env: LLAMA_ARG_CHAT_TEMPLATE_FILE)"
            fi
            COMPREPLY=( $(compgen -f -X '!*.jinja' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        --skip-chat-parsing )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
force a pure content parser, even if a Jinja template is specified; model will output everything in the content section, including any reasoning and/or tool calls (default: disabled)
(env: LLAMA_ARG_SKIP_CHAT_PARSING)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --simple-io )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use basic IO for better compatibility in subprocesses and limited consoles"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-prompts-dir )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
Log prompts to directory (auto-created if not present; only used for debugging, default: disabled)"
            fi
            COMPREPLY=( $(compgen -d -- "$cur") )
            return 0
        ;;
        --gpt-oss-20b-default )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use gpt-oss-20b (note: can download weights from the internet)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --gpt-oss-120b-default )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use gpt-oss-120b (note: can download weights from the internet)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --vision-gemma-4b-default )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use Gemma 3 4B QAT (note: can download weights from the internet)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --vision-gemma-12b-default )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use Gemma 3 12B QAT (note: can download weights from the internet)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-default )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
enable default speculative decoding config"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
    esac

case "$curr" in
    -* )
        COMPREPLY=( $(compgen -W "${opts}" -- "$curr") )
        return 0
    ;;
esac
} && complete -F _comp_cmd_llama_cli llama-cli

_comp_cmd_llama_completion()
{
    local curr prev opts
    COMPREPLY=()
    curr="${COMP_WORDS[COMP_CWORD]}"
    prev="${COMP_WORDS[COMP_CWORD-1]}"

    opts="
        -h --help --usage
        --version
        -cl --cache-list
        --completion-bash
        -t --threads
        -tb --threads-batch
        -C --cpu-mask
        -Cr --cpu-range
        --cpu-strict
        --prio
        --poll
        -Cb --cpu-mask-batch
        -Crb --cpu-range-batch
        --cpu-strict-batch
        --prio-batch
        --poll-batch
        -c --ctx-size
        -n --predict --n-predict
        -b --batch-size
        -ub --ubatch-size
        --keep
        --swa-full
        -fa --flash-attn
        -p --prompt
        --perf
        -f --file
        -bf --binary-file
        -e --escape
        --rope-scaling
        --rope-scale
        --rope-freq-base
        --rope-freq-scale
        --yarn-orig-ctx
        --yarn-ext-factor
        --yarn-attn-factor
        --yarn-beta-slow
        --yarn-beta-fast
        -kvo --kv-offload
        --repack
        --no-host
        -ctk --cache-type-k
        -ctv --cache-type-v
        -dt --defrag-thold
        -np --parallel
        --rpc
        -lm --load-mode
        -lzm --lazy-mode
        --numa
        -dev --device
        --list-devices
        -ot --override-tensor
        -cmoe --cpu-moe
        -ncmoe --n-cpu-moe
        --moe-cache-mib
        -ncffn --n-cpu-ffn
        -ngl --gpu-layers --n-gpu-layers
        -sm --split-mode
        -ts --tensor-split
        -mg --main-gpu
        -fit --fit
        -fitt --fit-target
        -fitc --fit-ctx
        --check-tensors
        --override-kv
        --op-offload
        --lora
        --lora-scaled
        --control-vector
        --control-vector-scaled
        --control-vector-layer-range
        -m --model
        -mu --model-url
        -dr --docker-repo
        -hf -hfr --hf-repo
        -hff --hf-file
        -hft --hf-token
        --log-disable
        --log-file
        --log-jsonl
        --log-colors
        -v --verbose --log-verbose
        --offline
        -lv --verbosity --log-verbosity
        --log-prefix
        --log-timestamps
        --spec-draft-type-k -ctkd --cache-type-k-draft
        --spec-draft-type-v -ctvd --cache-type-v-draft
        --samplers
        -s --seed
        --sampler-seq --sampling-seq
        --ignore-eos
        --temp --temperature
        --top-k
        --top-p
        --min-p
        --top-nsigma --top-n-sigma
        --xtc-probability
        --xtc-threshold
        --typical --typical-p
        --repeat-last-n
        --repeat-penalty
        --presence-penalty
        --frequency-penalty
        --dry-multiplier
        --dry-base
        --dry-allowed-length
        --dry-penalty-last-n
        --dry-sequence-breaker
        --adaptive-target
        --adaptive-decay
        --dynatemp-range
        --dynatemp-exp
        --mirostat
        --mirostat-lr
        --mirostat-ent
        -l --logit-bias
        --grammar
        --grammar-file
        -j --json-schema
        -jf --json-schema-file
        -bs --backend-sampling
        --verbose-prompt
        --display-prompt
        -co --color
        --context-shift
        -sys --system-prompt
        -sysf --system-prompt-file
        -ptc --print-token-count
        --prompt-cache
        --prompt-cache-all
        --prompt-cache-ro
        -r --reverse-prompt
        -sp --special
        -cnv --conversation
        -st --single-turn
        -i --interactive
        -if --interactive-first
        -mli --multiline-input
        --in-prefix-bos
        --in-prefix
        --in-suffix
        --warmup
        -gan --grp-attn-n
        -gaw --grp-attn-w
        --jinja
        --reasoning-format
        -rea --reasoning
        --reasoning-effort
        --reasoning-budget
        --reasoning-budget-message
        --reasoning-preserve
        --chat-template
        --chat-template-file
        --skip-chat-parsing
        --simple-io
    "

    case "$prev" in
        -h | --help | --usage )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print usage and exit"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --version )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
show version and build info"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -cl | --cache-list )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
show list of models in cache"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --completion-bash )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print source-able bash completion script for llama.cpp"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -t | --threads )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of CPU threads to use during generation (default: -1)
(env: LLAMA_ARG_THREADS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -tb | --threads-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of threads to use during batch and prompt processing (default: same as --threads)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -C | --cpu-mask )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
CPU affinity mask: arbitrarily long hex. Complements cpu-range (default: \"\")"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Cr | --cpu-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
range of CPUs for affinity. Complements --cpu-mask"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --cpu-strict )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use strict CPU placement (default: 0)
"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --prio )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set process/thread priority : low(-1), normal(0), medium(1), high(2), realtime(3) (default: 0)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --poll )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use polling level to wait for work (0 - no polling, default: 50)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Cb | --cpu-mask-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
CPU affinity mask: arbitrarily long hex. Complements cpu-range-batch (default: same as --cpu-mask)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Crb | --cpu-range-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ranges of CPUs for affinity. Complements --cpu-mask-batch"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --cpu-strict-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use strict CPU placement (default: same as --cpu-strict)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --prio-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set process/thread priority : 0-normal, 1-medium, 2-high, 3-realtime (default: 0)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --poll-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use polling to wait for work (default: same as --poll)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        -c | --ctx-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
size of the prompt context (default: 0, 0 = loaded from model)
(env: LLAMA_ARG_CTX_SIZE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -n | --predict | --n-predict )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of tokens to predict (default: -1, -1 = infinity, -2 = until context filled)
(env: LLAMA_ARG_N_PREDICT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -b | --batch-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
logical maximum batch size (default: 2048)
(env: LLAMA_ARG_BATCH)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ub | --ubatch-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
physical maximum batch size (default: 512)
(env: LLAMA_ARG_UBATCH)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --keep )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of tokens to keep from the initial prompt (default: 0, -1 = all)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --swa-full )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fa | --flash-attn )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
set Flash Attention use ('on', 'off', or 'auto', default: 'auto')
(env: LLAMA_ARG_FLASH_ATTN)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        -p | --prompt )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
prompt to start generation with; for system message, use -sys"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --perf )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable internal libllama performance timings (default: false)
(env: LLAMA_ARG_PERF)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -f | --file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
a file containing the prompt (default: none)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -bf | --binary-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
binary file containing the prompt (default: none)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -e | --escape )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to process escapes sequences (\\n, \\r, \\t, \\', \\\", \\\\) (default: true)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-scaling )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
RoPE frequency scaling method, defaults to linear unless specified by the model
(env: LLAMA_ARG_ROPE_SCALING_TYPE)"
            fi
            COMPREPLY=( $(compgen -W 'none linear yarn' -- "$cur") )
            return 0
        ;;
        --rope-scale )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE context scaling factor, expands context by a factor of N
(env: LLAMA_ARG_ROPE_SCALE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-freq-base )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE base frequency, used by NTK-aware scaling (default: loaded from model)
(env: LLAMA_ARG_ROPE_FREQ_BASE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-freq-scale )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE frequency scaling factor, expands context by a factor of 1/N
(env: LLAMA_ARG_ROPE_FREQ_SCALE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-orig-ctx )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: original context size of model (default: 0 = model training context size)
(env: LLAMA_ARG_YARN_ORIG_CTX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-ext-factor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: extrapolation mix factor (default: -1.00, 0.0 = full interpolation)
(env: LLAMA_ARG_YARN_EXT_FACTOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-attn-factor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: scale sqrt(t) or attention magnitude (default: -1.00)
(env: LLAMA_ARG_YARN_ATTN_FACTOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-beta-slow )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: high correction dim or alpha (default: -1.00)
(env: LLAMA_ARG_YARN_BETA_SLOW)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-beta-fast )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: low correction dim or beta (default: -1.00)
(env: LLAMA_ARG_YARN_BETA_FAST)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -kvo | --kv-offload )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable KV cache offloading (default: enabled)
(env: LLAMA_ARG_KV_OFFLOAD)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repack )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable weight repacking (default: enabled)
(env: LLAMA_ARG_REPACK)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --no-host )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
bypass host buffer allowing extra buffers to be used
(env: LLAMA_ARG_NO_HOST)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ctk | --cache-type-k )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ctv | --cache-type-v )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -dt | --defrag-thold )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
KV cache defragmentation threshold (DEPRECATED)
(env: LLAMA_ARG_DEFRAG_THOLD)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -np | --parallel )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of parallel sequences to decode (default: 1)
(env: LLAMA_ARG_N_PARALLEL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rpc )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
comma-separated list of RPC servers (host:port)
(env: LLAMA_ARG_RPC)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -lm | --load-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
model loading mode (default: auto)
- 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)"
            fi
            COMPREPLY=( $(compgen -W 'auto none mmap mlock mmap+mlock dio' -- "$cur") )
            return 0
        ;;
        -lzm | --lazy-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
on-demand reading of certain tensors, for example per-layer embeddings (default: auto)
- on: read the rows of such tensors from disk on demand instead of keeping them resident (requires mmap)
- auto: on, but only for tensors larger than 4 GiB
- off: always keep them resident
(env: LLAMA_ARG_LAZY_MODE)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        --numa )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
attempt optimizations that help on some NUMA systems
- 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)"
            fi
            COMPREPLY=( $(compgen -W 'distribute isolate numactl' -- "$cur") )
            return 0
        ;;
        -dev | --device )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --list-devices )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print list of available devices and exit"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ot | --override-tensor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
override tensor buffer type
(env: LLAMA_ARG_OVERRIDE_TENSOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -cmoe | --cpu-moe )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep all Mixture of Experts (MoE) weights in the CPU
(env: LLAMA_ARG_CPU_MOE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ncmoe | --n-cpu-moe )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep the Mixture of Experts (MoE) weights of the first N layers in the CPU
(env: LLAMA_ARG_N_CPU_MOE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --moe-cache-mib )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
GPU cache size in MiB for the MoE experts kept in the CPU. with multiple GPUs, it is split among them like the layers (--tensor-split) (default: 0, disabled)
(env: LLAMA_ARG_MOE_CACHE_MIB)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ncffn | --n-cpu-ffn )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep the dense FFN weights of the first N layers in the CPU
(dense models; for MoE expert weights use --n-cpu-moe)
(env: LLAMA_ARG_N_CPU_FFN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ngl | --gpu-layers | --n-gpu-layers )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
max. number of layers to store in VRAM, either an exact number, 'auto', or 'all' (default: auto)
(env: LLAMA_ARG_N_GPU_LAYERS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -sm | --split-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
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)"
            fi
            COMPREPLY=( $(compgen -W 'none layer row split' -- "$cur") )
            return 0
        ;;
        -ts | --tensor-split )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
fraction of the model to offload to each GPU, comma-separated list of proportions, e.g. 3,1
(env: LLAMA_ARG_TENSOR_SPLIT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -mg | --main-gpu )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fit | --fit )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
whether to adjust unset arguments to fit in device memory ('on' or 'off', default: 'on')
(env: LLAMA_ARG_FIT)"
            fi
            COMPREPLY=( $(compgen -W 'on off' -- "$cur") )
            return 0
        ;;
        -fitt | --fit-target )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fitc | --fit-ctx )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
minimum ctx size that can be set by --fit option, default: 4096
(env: LLAMA_ARG_FIT_CTX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --check-tensors )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
check model tensor data for invalid values (default: false)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --override-kv )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --op-offload )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to offload host tensor operations to device (default: true)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --lora )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to LoRA adapter (use comma-separated values to load multiple adapters)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --lora-scaled )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to LoRA adapter with user defined scaling (format: FNAME:SCALE,...)
note: use comma-separated values"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add a control vector
note: use comma-separated values to add multiple control vectors"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector-scaled )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add a control vector with user defined scaling SCALE
note: use comma-separated values (format: FNAME:SCALE,...)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector-layer-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
layer range to apply the control vector(s) to, start and end inclusive"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -m | --model )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
model path to load
(env: LLAMA_ARG_MODEL)"
            fi
            COMPREPLY=( $(compgen -f -X '!*.gguf' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -mu | --model-url )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
model download url (default: unused)
(env: LLAMA_ARG_MODEL_URL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -dr | --docker-repo )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Docker Hub model repository. repo is optional, default to ai/. quant is optional, default to :latest.
example: gemma3
(default: unused)
(env: LLAMA_ARG_DOCKER_REPO)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hf | -hfr | --hf-repo )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face model repository; quant is optional, case-insensitive, default to Q4_K_M, or falls back to the first file in the repo if Q4_K_M doesn't exist.
mmproj is also downloaded automatically if available. to disable, add --no-mmproj
example: ggml-org/GLM-4.7-Flash-GGUF:Q4_K_M
(default: unused)
(env: LLAMA_ARG_HF_REPO)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hff | --hf-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face model file. If specified, it will override the quant in --hf-repo (default: unused)
(env: LLAMA_ARG_HF_FILE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hft | --hf-token )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face access token (default: value from HF_TOKEN environment variable)
(env: HF_TOKEN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-disable )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log disable"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log to file
(env: LLAMA_ARG_LOG_FILE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-jsonl )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log as JSONL (one JSON object per line) to stdout, this also disables colored logging (default: disabled)
(env: LLAMA_ARG_LOG_JSONL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-colors )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
Set colored logging ('on', 'off', or 'auto', default: 'auto')
'auto' enables colors when output is to a terminal
(env: LLAMA_ARG_LOG_COLORS)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        -v | --verbose | --log-verbose )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Set verbosity level to infinity (i.e. log all messages, useful for debugging)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --offline )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Offline mode: forces use of cache, prevents network access
(env: LLAMA_ARG_OFFLINE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -lv | --verbosity | --log-verbosity )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Set the verbosity threshold. Messages with a higher verbosity will be ignored. Values:
 - 0: generic output
 - 1: error
 - 2: warning
 - 3: info
 - 4: trace (more info)
 - 5: debug
(default: 3)

(env: LLAMA_ARG_LOG_VERBOSITY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-prefix )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Enable prefix in log messages
(env: LLAMA_ARG_LOG_PREFIX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-timestamps )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Enable timestamps in log messages
(env: LLAMA_ARG_LOG_TIMESTAMPS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-type-k | -ctkd | --cache-type-k-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-type-v | -ctvd | --cache-type-v-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
KV cache data type for V 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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --samplers )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
samplers that will be used for generation in the order, separated by ';'
(default: penalties;dry;top_n_sigma;top_k;typ_p;top_p;min_p;xtc;temperature)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -s | --seed )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RNG seed (default: -1, use random seed for -1)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --sampler-seq | --sampling-seq )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
simplified sequence for samplers that will be used (default: edskypmxt)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --ignore-eos )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ignore end of stream token and continue generating (implies --logit-bias EOS-inf)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --temp | --temperature )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
temperature (default: 0.80)
(env: LLAMA_ARG_TEMPERATURE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-k )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-k sampling (default: 40, 0 = disabled)
(env: LLAMA_ARG_TOP_K)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-p sampling (default: 0.95, 1.0 = disabled)
(env: LLAMA_ARG_TOP_P)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --min-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
min-p sampling (default: 0.05, 0.0 = disabled)
(env: LLAMA_ARG_MIN_P)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-nsigma | --top-n-sigma )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-n-sigma sampling (default: -1.00, -1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --xtc-probability )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
xtc probability (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --xtc-threshold )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
xtc threshold (default: 0.10, 1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --typical | --typical-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
locally typical sampling, parameter p (default: 1.00, 1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repeat-last-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
last n tokens to consider for penalize (default: 64, 0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repeat-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
penalize repeat sequence of tokens (default: 1.00, 1.0 = disabled)
(env: LLAMA_ARG_REPEAT_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --presence-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
repeat alpha presence penalty (default: 0.00, 0.0 = disabled)
(env: LLAMA_ARG_PRESENCE_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --frequency-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
repeat alpha frequency penalty (default: 0.00, 0.0 = disabled)
(env: LLAMA_ARG_FREQUENCY_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-multiplier )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY sampling multiplier (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-base )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY sampling base value (default: 1.75)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-allowed-length )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set allowed length for DRY sampling (default: 2)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-penalty-last-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY penalty for the last n tokens (default: 64, 0 = disable)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-sequence-breaker )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add sequence breaker for DRY sampling, clearing out default breakers ('\\n', ':', '\"', '*') in the process; use \"none\" to not use any sequence breakers
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --adaptive-target )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
adaptive-p: select tokens near this probability (valid range 0.0 to 1.0; negative = disabled) (default: -1.00)
[(more info)](https://github.com/ggml-org/llama.cpp/pull/17927)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --adaptive-decay )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
adaptive-p: 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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dynatemp-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
dynamic temperature range (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dynatemp-exp )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
dynamic temperature exponent (default: 1.00)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use Mirostat sampling.
Top K, Nucleus and Locally Typical samplers are ignored if used.
(default: 0, 0 = disabled, 1 = Mirostat, 2 = Mirostat 2.0)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat-lr )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Mirostat learning rate, parameter eta (default: 0.10)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat-ent )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Mirostat target entropy, parameter tau (default: 5.00)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -l | --logit-bias )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
modifies the likelihood of token appearing in the completion,
i.e. \`--logit-bias 15043+1\` to increase likelihood of token ' Hello',
or \`--logit-bias 15043-1\` to decrease likelihood of token ' Hello'"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --grammar )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
BNF-like grammar to constrain generations (see samples in grammars/ dir)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --grammar-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
file to read grammar from"
            fi
            COMPREPLY=( $(compgen -f -X '!*.gbnf' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -j | --json-schema )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
JSON schema to constrain generations (https://json-schema.org/), e.g. \`{\"type\": \"object\"}\` for any JSON object"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -jf | --json-schema-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
File containing a JSON schema to constrain generations (https://json-schema.org/), e.g. \`{\"type\": \"object\"}\` for any JSON object"
            fi
            COMPREPLY=( $(compgen -f -X '!*.json' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -bs | --backend-sampling )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
enable backend sampling (experimental) (default: disabled)
(env: LLAMA_ARG_BACKEND_SAMPLING)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --verbose-prompt )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print a verbose prompt before generation (default: false)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --display-prompt )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to print prompt at generation (default: true)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -co | --color )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
Colorize output to distinguish prompt and user input from generations ('on', 'off', or 'auto', default: 'auto')
'auto' enables colors when output is to a terminal"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        --context-shift )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to use context shift on infinite text generation (default: disabled)
(env: LLAMA_ARG_CONTEXT_SHIFT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -sys | --system-prompt )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
system prompt to use with model (if applicable, depending on chat template)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -sysf | --system-prompt-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
a file containing the system prompt (default: none)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ptc | --print-token-count )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print token count every N tokens (default: -1)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --prompt-cache )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
file to cache prompt state for faster startup (default: none)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --prompt-cache-all )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
if specified, saves user input and generations to cache as well
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --prompt-cache-ro )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
if specified, uses the prompt cache but does not update it"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -r | --reverse-prompt )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
halt generation at PROMPT, return control in interactive mode
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -sp | --special )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
special tokens output enabled (default: false)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -cnv | --conversation )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to run in conversation mode:
- does not print special tokens and suffix/prefix
- interactive mode is also enabled
(default: auto enabled if chat template is available)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -st | --single-turn )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
run conversation for a single turn only, then exit when done
will not be interactive if first turn is predefined with --prompt
(default: false)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -i | --interactive )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
run in interactive mode (default: false)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -if | --interactive-first )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
run in interactive mode and wait for input right away (default: false)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -mli | --multiline-input )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
allows you to write or paste multiple lines without ending each in '\\'"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --in-prefix-bos )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
prefix BOS to user inputs, preceding the \`--in-prefix\` string"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --in-prefix )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
string to prefix user inputs with (default: empty)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --in-suffix )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
string to suffix after user inputs with (default: empty)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --warmup )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to perform warmup with an empty run (default: enabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -gan | --grp-attn-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
group-attention factor (default: 1)
(env: LLAMA_ARG_GRP_ATTN_N)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -gaw | --grp-attn-w )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
group-attention width (default: 512)
(env: LLAMA_ARG_GRP_ATTN_W)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --jinja )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to use jinja template engine for chat (default: disabled)
(env: LLAMA_ARG_JINJA)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --reasoning-format )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
controls whether thought tags are allowed and/or extracted from the response, and in which format they're returned; one of:
- none: leaves thoughts unparsed in \`message.content\`
- deepseek: puts thoughts in \`message.reasoning_content\`
- deepseek-legacy: keeps \`<think>\` tags in \`message.content\` while also populating \`message.reasoning_content\`
(default: auto)
(env: LLAMA_ARG_THINK)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -rea | --reasoning )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Use reasoning/thinking in the chat ('on', 'off', or 'auto', default: 'auto' (detect from template))
(env: LLAMA_ARG_REASONING)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --reasoning-effort )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
reasoning effort level given to the chat template: 'default' to keep the template default,
or a level such as 'minimal', 'low', 'medium', 'high', 'xhigh' or 'max' (default: default)
(env: LLAMA_ARG_REASONING_EFFORT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --reasoning-budget )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
token budget for thinking: -1 for unrestricted, 0 for immediate end, N>0 for token budget (default: -1)
(env: LLAMA_ARG_THINK_BUDGET)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --reasoning-budget-message )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
message injected before the end-of-thinking tag when reasoning budget is exhausted (default: none)
(env: LLAMA_ARG_THINK_BUDGET_MESSAGE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --reasoning-preserve )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
preserve reasoning trace in the full history, not just the last assistant message (default: enabled)
compatible with certain templates having 'supports_preserve_reasoning' capability
example: https://docs.z.ai/guides/capabilities/thinking-mode#preserved-thinking
(env: LLAMA_ARG_REASONING_PRESERVE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --chat-template )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set custom jinja chat template (default: template taken from model's metadata)
if suffix/prefix are specified, template will be disabled
only commonly used templates are accepted (unless --jinja is set before this flag):
list of built-in templates:
bailing, bailing-think, bailing2, chatglm3, chatglm4, chatml, command-r, deepseek, deepseek-ocr, deepseek2, deepseek3, exaone-moe, exaone3, exaone4, falcon3, gemma, gigachat, glmedge, gpt-oss, granite, granite-4.0, granite-4.1, grok-2, hunyuan-dense, hunyuan-moe, hunyuan-vl, kimi-k2, llama2, llama2-sys, llama2-sys-bos, llama2-sys-strip, llama3, llama4, megrez, minicpm, mistral-v1, mistral-v3, mistral-v3-tekken, mistral-v7, mistral-v7-tekken, monarch, openchat, orion, pangu-embedded, phi3, phi4, rwkv-world, seed_oss, smolvlm, solar-open, vicuna, vicuna-orca, yandex, zephyr
(env: LLAMA_ARG_CHAT_TEMPLATE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --chat-template-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
set custom jinja chat template file (default: template taken from model's metadata)
if suffix/prefix are specified, template will be disabled
only commonly used templates are accepted (unless --jinja is set before this flag):
list of built-in templates:
bailing, bailing-think, bailing2, chatglm3, chatglm4, chatml, command-r, deepseek, deepseek-ocr, deepseek2, deepseek3, exaone-moe, exaone3, exaone4, falcon3, gemma, gigachat, glmedge, gpt-oss, granite, granite-4.0, granite-4.1, grok-2, hunyuan-dense, hunyuan-moe, hunyuan-vl, kimi-k2, llama2, llama2-sys, llama2-sys-bos, llama2-sys-strip, llama3, llama4, megrez, minicpm, mistral-v1, mistral-v3, mistral-v3-tekken, mistral-v7, mistral-v7-tekken, monarch, openchat, orion, pangu-embedded, phi3, phi4, rwkv-world, seed_oss, smolvlm, solar-open, vicuna, vicuna-orca, yandex, zephyr
(env: LLAMA_ARG_CHAT_TEMPLATE_FILE)"
            fi
            COMPREPLY=( $(compgen -f -X '!*.jinja' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        --skip-chat-parsing )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
force a pure content parser, even if a Jinja template is specified; model will output everything in the content section, including any reasoning and/or tool calls (default: disabled)
(env: LLAMA_ARG_SKIP_CHAT_PARSING)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --simple-io )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use basic IO for better compatibility in subprocesses and limited consoles"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
    esac

case "$curr" in
    -* )
        COMPREPLY=( $(compgen -W "${opts}" -- "$curr") )
        return 0
    ;;
esac
} && complete -F _comp_cmd_llama_completion llama-completion

_comp_cmd_llama_debug()
{
    local curr prev opts
    COMPREPLY=()
    curr="${COMP_WORDS[COMP_CWORD]}"
    prev="${COMP_WORDS[COMP_CWORD-1]}"

    opts="
        -h --help --usage
        --version
        -cl --cache-list
        --completion-bash
        -t --threads
        -tb --threads-batch
        -C --cpu-mask
        -Cr --cpu-range
        --cpu-strict
        --prio
        --poll
        -Cb --cpu-mask-batch
        -Crb --cpu-range-batch
        --cpu-strict-batch
        --prio-batch
        --poll-batch
        -c --ctx-size
        -n --predict --n-predict
        -b --batch-size
        -ub --ubatch-size
        --keep
        --swa-full
        -fa --flash-attn
        -p --prompt
        --perf
        -f --file
        -bf --binary-file
        -e --escape
        --rope-scaling
        --rope-scale
        --rope-freq-base
        --rope-freq-scale
        --yarn-orig-ctx
        --yarn-ext-factor
        --yarn-attn-factor
        --yarn-beta-slow
        --yarn-beta-fast
        -kvo --kv-offload
        --repack
        --no-host
        -ctk --cache-type-k
        -ctv --cache-type-v
        -dt --defrag-thold
        -np --parallel
        --rpc
        -lm --load-mode
        -lzm --lazy-mode
        --numa
        -dev --device
        --list-devices
        -ot --override-tensor
        -cmoe --cpu-moe
        -ncmoe --n-cpu-moe
        --moe-cache-mib
        -ncffn --n-cpu-ffn
        -ngl --gpu-layers --n-gpu-layers
        -sm --split-mode
        -ts --tensor-split
        -mg --main-gpu
        -fit --fit
        -fitt --fit-target
        -fitc --fit-ctx
        --check-tensors
        --override-kv
        --op-offload
        --lora
        --lora-scaled
        --control-vector
        --control-vector-scaled
        --control-vector-layer-range
        -m --model
        -mu --model-url
        -dr --docker-repo
        -hf -hfr --hf-repo
        -hff --hf-file
        -hft --hf-token
        --log-disable
        --log-file
        --log-jsonl
        --log-colors
        -v --verbose --log-verbose
        --offline
        -lv --verbosity --log-verbosity
        --log-prefix
        --log-timestamps
        --spec-draft-type-k -ctkd --cache-type-k-draft
        --spec-draft-type-v -ctvd --cache-type-v-draft
        --samplers
        -s --seed
        --sampler-seq --sampling-seq
        --ignore-eos
        --temp --temperature
        --top-k
        --top-p
        --min-p
        --top-nsigma --top-n-sigma
        --xtc-probability
        --xtc-threshold
        --typical --typical-p
        --repeat-last-n
        --repeat-penalty
        --presence-penalty
        --frequency-penalty
        --dry-multiplier
        --dry-base
        --dry-allowed-length
        --dry-penalty-last-n
        --dry-sequence-breaker
        --adaptive-target
        --adaptive-decay
        --dynatemp-range
        --dynatemp-exp
        --mirostat
        --mirostat-lr
        --mirostat-ent
        -l --logit-bias
        --grammar
        --grammar-file
        -j --json-schema
        -jf --json-schema-file
        -bs --backend-sampling
        --warmup
        --pooling
        --embd-normalize
        --embedding --embeddings
        --save-logits
        --logits-output-dir
        --tensor-filter
    "

    case "$prev" in
        -h | --help | --usage )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print usage and exit"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --version )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
show version and build info"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -cl | --cache-list )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
show list of models in cache"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --completion-bash )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print source-able bash completion script for llama.cpp"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -t | --threads )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of CPU threads to use during generation (default: -1)
(env: LLAMA_ARG_THREADS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -tb | --threads-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of threads to use during batch and prompt processing (default: same as --threads)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -C | --cpu-mask )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
CPU affinity mask: arbitrarily long hex. Complements cpu-range (default: \"\")"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Cr | --cpu-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
range of CPUs for affinity. Complements --cpu-mask"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --cpu-strict )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use strict CPU placement (default: 0)
"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --prio )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set process/thread priority : low(-1), normal(0), medium(1), high(2), realtime(3) (default: 0)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --poll )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use polling level to wait for work (0 - no polling, default: 50)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Cb | --cpu-mask-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
CPU affinity mask: arbitrarily long hex. Complements cpu-range-batch (default: same as --cpu-mask)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Crb | --cpu-range-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ranges of CPUs for affinity. Complements --cpu-mask-batch"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --cpu-strict-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use strict CPU placement (default: same as --cpu-strict)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --prio-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set process/thread priority : 0-normal, 1-medium, 2-high, 3-realtime (default: 0)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --poll-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use polling to wait for work (default: same as --poll)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        -c | --ctx-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
size of the prompt context (default: 0, 0 = loaded from model)
(env: LLAMA_ARG_CTX_SIZE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -n | --predict | --n-predict )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of tokens to predict (default: -1, -1 = infinity)
(env: LLAMA_ARG_N_PREDICT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -b | --batch-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
logical maximum batch size (default: 2048)
(env: LLAMA_ARG_BATCH)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ub | --ubatch-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
physical maximum batch size (default: 512)
(env: LLAMA_ARG_UBATCH)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --keep )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of tokens to keep from the initial prompt (default: 0, -1 = all)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --swa-full )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fa | --flash-attn )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
set Flash Attention use ('on', 'off', or 'auto', default: 'auto')
(env: LLAMA_ARG_FLASH_ATTN)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        -p | --prompt )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
prompt to start generation with; for system message, use -sys"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --perf )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable internal libllama performance timings (default: false)
(env: LLAMA_ARG_PERF)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -f | --file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
a file containing the prompt (default: none)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -bf | --binary-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
binary file containing the prompt (default: none)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -e | --escape )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to process escapes sequences (\\n, \\r, \\t, \\', \\\", \\\\) (default: true)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-scaling )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
RoPE frequency scaling method, defaults to linear unless specified by the model
(env: LLAMA_ARG_ROPE_SCALING_TYPE)"
            fi
            COMPREPLY=( $(compgen -W 'none linear yarn' -- "$cur") )
            return 0
        ;;
        --rope-scale )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE context scaling factor, expands context by a factor of N
(env: LLAMA_ARG_ROPE_SCALE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-freq-base )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE base frequency, used by NTK-aware scaling (default: loaded from model)
(env: LLAMA_ARG_ROPE_FREQ_BASE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-freq-scale )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE frequency scaling factor, expands context by a factor of 1/N
(env: LLAMA_ARG_ROPE_FREQ_SCALE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-orig-ctx )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: original context size of model (default: 0 = model training context size)
(env: LLAMA_ARG_YARN_ORIG_CTX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-ext-factor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: extrapolation mix factor (default: -1.00, 0.0 = full interpolation)
(env: LLAMA_ARG_YARN_EXT_FACTOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-attn-factor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: scale sqrt(t) or attention magnitude (default: -1.00)
(env: LLAMA_ARG_YARN_ATTN_FACTOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-beta-slow )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: high correction dim or alpha (default: -1.00)
(env: LLAMA_ARG_YARN_BETA_SLOW)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-beta-fast )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: low correction dim or beta (default: -1.00)
(env: LLAMA_ARG_YARN_BETA_FAST)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -kvo | --kv-offload )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable KV cache offloading (default: enabled)
(env: LLAMA_ARG_KV_OFFLOAD)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repack )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable weight repacking (default: enabled)
(env: LLAMA_ARG_REPACK)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --no-host )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
bypass host buffer allowing extra buffers to be used
(env: LLAMA_ARG_NO_HOST)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ctk | --cache-type-k )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ctv | --cache-type-v )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -dt | --defrag-thold )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
KV cache defragmentation threshold (DEPRECATED)
(env: LLAMA_ARG_DEFRAG_THOLD)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -np | --parallel )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of parallel sequences to decode (default: 1)
(env: LLAMA_ARG_N_PARALLEL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rpc )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
comma-separated list of RPC servers (host:port)
(env: LLAMA_ARG_RPC)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -lm | --load-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
model loading mode (default: auto)
- 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)"
            fi
            COMPREPLY=( $(compgen -W 'auto none mmap mlock mmap+mlock dio' -- "$cur") )
            return 0
        ;;
        -lzm | --lazy-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
on-demand reading of certain tensors, for example per-layer embeddings (default: auto)
- on: read the rows of such tensors from disk on demand instead of keeping them resident (requires mmap)
- auto: on, but only for tensors larger than 4 GiB
- off: always keep them resident
(env: LLAMA_ARG_LAZY_MODE)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        --numa )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
attempt optimizations that help on some NUMA systems
- 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)"
            fi
            COMPREPLY=( $(compgen -W 'distribute isolate numactl' -- "$cur") )
            return 0
        ;;
        -dev | --device )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --list-devices )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print list of available devices and exit"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ot | --override-tensor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
override tensor buffer type
(env: LLAMA_ARG_OVERRIDE_TENSOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -cmoe | --cpu-moe )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep all Mixture of Experts (MoE) weights in the CPU
(env: LLAMA_ARG_CPU_MOE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ncmoe | --n-cpu-moe )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep the Mixture of Experts (MoE) weights of the first N layers in the CPU
(env: LLAMA_ARG_N_CPU_MOE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --moe-cache-mib )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
GPU cache size in MiB for the MoE experts kept in the CPU. with multiple GPUs, it is split among them like the layers (--tensor-split) (default: 0, disabled)
(env: LLAMA_ARG_MOE_CACHE_MIB)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ncffn | --n-cpu-ffn )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep the dense FFN weights of the first N layers in the CPU
(dense models; for MoE expert weights use --n-cpu-moe)
(env: LLAMA_ARG_N_CPU_FFN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ngl | --gpu-layers | --n-gpu-layers )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
max. number of layers to store in VRAM, either an exact number, 'auto', or 'all' (default: auto)
(env: LLAMA_ARG_N_GPU_LAYERS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -sm | --split-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
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)"
            fi
            COMPREPLY=( $(compgen -W 'none layer row split' -- "$cur") )
            return 0
        ;;
        -ts | --tensor-split )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
fraction of the model to offload to each GPU, comma-separated list of proportions, e.g. 3,1
(env: LLAMA_ARG_TENSOR_SPLIT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -mg | --main-gpu )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fit | --fit )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
whether to adjust unset arguments to fit in device memory ('on' or 'off', default: 'on')
(env: LLAMA_ARG_FIT)"
            fi
            COMPREPLY=( $(compgen -W 'on off' -- "$cur") )
            return 0
        ;;
        -fitt | --fit-target )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fitc | --fit-ctx )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
minimum ctx size that can be set by --fit option, default: 4096
(env: LLAMA_ARG_FIT_CTX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --check-tensors )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
check model tensor data for invalid values (default: false)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --override-kv )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --op-offload )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to offload host tensor operations to device (default: true)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --lora )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to LoRA adapter (use comma-separated values to load multiple adapters)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --lora-scaled )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to LoRA adapter with user defined scaling (format: FNAME:SCALE,...)
note: use comma-separated values"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add a control vector
note: use comma-separated values to add multiple control vectors"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector-scaled )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add a control vector with user defined scaling SCALE
note: use comma-separated values (format: FNAME:SCALE,...)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector-layer-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
layer range to apply the control vector(s) to, start and end inclusive"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -m | --model )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
model path to load
(env: LLAMA_ARG_MODEL)"
            fi
            COMPREPLY=( $(compgen -f -X '!*.gguf' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -mu | --model-url )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
model download url (default: unused)
(env: LLAMA_ARG_MODEL_URL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -dr | --docker-repo )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Docker Hub model repository. repo is optional, default to ai/. quant is optional, default to :latest.
example: gemma3
(default: unused)
(env: LLAMA_ARG_DOCKER_REPO)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hf | -hfr | --hf-repo )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face model repository; quant is optional, case-insensitive, default to Q4_K_M, or falls back to the first file in the repo if Q4_K_M doesn't exist.
mmproj is also downloaded automatically if available. to disable, add --no-mmproj
example: ggml-org/GLM-4.7-Flash-GGUF:Q4_K_M
(default: unused)
(env: LLAMA_ARG_HF_REPO)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hff | --hf-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face model file. If specified, it will override the quant in --hf-repo (default: unused)
(env: LLAMA_ARG_HF_FILE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hft | --hf-token )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face access token (default: value from HF_TOKEN environment variable)
(env: HF_TOKEN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-disable )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log disable"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log to file
(env: LLAMA_ARG_LOG_FILE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-jsonl )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log as JSONL (one JSON object per line) to stdout, this also disables colored logging (default: disabled)
(env: LLAMA_ARG_LOG_JSONL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-colors )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
Set colored logging ('on', 'off', or 'auto', default: 'auto')
'auto' enables colors when output is to a terminal
(env: LLAMA_ARG_LOG_COLORS)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        -v | --verbose | --log-verbose )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Set verbosity level to infinity (i.e. log all messages, useful for debugging)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --offline )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Offline mode: forces use of cache, prevents network access
(env: LLAMA_ARG_OFFLINE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -lv | --verbosity | --log-verbosity )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Set the verbosity threshold. Messages with a higher verbosity will be ignored. Values:
 - 0: generic output
 - 1: error
 - 2: warning
 - 3: info
 - 4: trace (more info)
 - 5: debug
(default: 3)

(env: LLAMA_ARG_LOG_VERBOSITY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-prefix )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Enable prefix in log messages
(env: LLAMA_ARG_LOG_PREFIX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-timestamps )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Enable timestamps in log messages
(env: LLAMA_ARG_LOG_TIMESTAMPS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-type-k | -ctkd | --cache-type-k-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-type-v | -ctvd | --cache-type-v-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
KV cache data type for V 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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --samplers )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
samplers that will be used for generation in the order, separated by ';'
(default: penalties;dry;top_n_sigma;top_k;typ_p;top_p;min_p;xtc;temperature)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -s | --seed )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RNG seed (default: -1, use random seed for -1)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --sampler-seq | --sampling-seq )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
simplified sequence for samplers that will be used (default: edskypmxt)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --ignore-eos )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ignore end of stream token and continue generating (implies --logit-bias EOS-inf)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --temp | --temperature )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
temperature (default: 0.80)
(env: LLAMA_ARG_TEMPERATURE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-k )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-k sampling (default: 40, 0 = disabled)
(env: LLAMA_ARG_TOP_K)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-p sampling (default: 0.95, 1.0 = disabled)
(env: LLAMA_ARG_TOP_P)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --min-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
min-p sampling (default: 0.05, 0.0 = disabled)
(env: LLAMA_ARG_MIN_P)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-nsigma | --top-n-sigma )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-n-sigma sampling (default: -1.00, -1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --xtc-probability )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
xtc probability (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --xtc-threshold )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
xtc threshold (default: 0.10, 1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --typical | --typical-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
locally typical sampling, parameter p (default: 1.00, 1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repeat-last-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
last n tokens to consider for penalize (default: 64, 0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repeat-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
penalize repeat sequence of tokens (default: 1.00, 1.0 = disabled)
(env: LLAMA_ARG_REPEAT_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --presence-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
repeat alpha presence penalty (default: 0.00, 0.0 = disabled)
(env: LLAMA_ARG_PRESENCE_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --frequency-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
repeat alpha frequency penalty (default: 0.00, 0.0 = disabled)
(env: LLAMA_ARG_FREQUENCY_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-multiplier )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY sampling multiplier (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-base )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY sampling base value (default: 1.75)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-allowed-length )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set allowed length for DRY sampling (default: 2)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-penalty-last-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY penalty for the last n tokens (default: 64, 0 = disable)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-sequence-breaker )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add sequence breaker for DRY sampling, clearing out default breakers ('\\n', ':', '\"', '*') in the process; use \"none\" to not use any sequence breakers
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --adaptive-target )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
adaptive-p: select tokens near this probability (valid range 0.0 to 1.0; negative = disabled) (default: -1.00)
[(more info)](https://github.com/ggml-org/llama.cpp/pull/17927)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --adaptive-decay )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
adaptive-p: 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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dynatemp-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
dynamic temperature range (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dynatemp-exp )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
dynamic temperature exponent (default: 1.00)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use Mirostat sampling.
Top K, Nucleus and Locally Typical samplers are ignored if used.
(default: 0, 0 = disabled, 1 = Mirostat, 2 = Mirostat 2.0)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat-lr )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Mirostat learning rate, parameter eta (default: 0.10)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat-ent )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Mirostat target entropy, parameter tau (default: 5.00)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -l | --logit-bias )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
modifies the likelihood of token appearing in the completion,
i.e. \`--logit-bias 15043+1\` to increase likelihood of token ' Hello',
or \`--logit-bias 15043-1\` to decrease likelihood of token ' Hello'"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --grammar )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
BNF-like grammar to constrain generations (see samples in grammars/ dir)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --grammar-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
file to read grammar from"
            fi
            COMPREPLY=( $(compgen -f -X '!*.gbnf' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -j | --json-schema )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
JSON schema to constrain generations (https://json-schema.org/), e.g. \`{\"type\": \"object\"}\` for any JSON object"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -jf | --json-schema-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
File containing a JSON schema to constrain generations (https://json-schema.org/), e.g. \`{\"type\": \"object\"}\` for any JSON object"
            fi
            COMPREPLY=( $(compgen -f -X '!*.json' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -bs | --backend-sampling )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
enable backend sampling (experimental) (default: disabled)
(env: LLAMA_ARG_BACKEND_SAMPLING)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --warmup )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to perform warmup with an empty run (default: enabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --pooling )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
pooling type for embeddings, use model default if unspecified
(env: LLAMA_ARG_POOLING)"
            fi
            COMPREPLY=( $(compgen -W 'none mean cls last rank' -- "$cur") )
            return 0
        ;;
        --embd-normalize )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
normalisation for embeddings (default: 2) (-1=none, 0=max absolute int16, 1=taxicab, 2=euclidean, >2=p-norm)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --embedding | --embeddings )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
restrict to only support embedding use case; use only with dedicated embedding models (default: disabled)
(env: LLAMA_ARG_EMBEDDINGS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --save-logits )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
save final logits to files for verification (default: false)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --logits-output-dir )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
directory for saving logits output files (default: data)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --tensor-filter )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
filter tensor names for debug output (regex pattern, can be specified multiple times)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
    esac

case "$curr" in
    -* )
        COMPREPLY=( $(compgen -W "${opts}" -- "$curr") )
        return 0
    ;;
esac
} && complete -F _comp_cmd_llama_debug llama-debug

_comp_cmd_llama_diffusion_cli()
{
    local curr prev opts
    COMPREPLY=()
    curr="${COMP_WORDS[COMP_CWORD]}"
    prev="${COMP_WORDS[COMP_CWORD-1]}"

    opts="
        -h --help --usage
        --version
        -cl --cache-list
        --completion-bash
        -t --threads
        -tb --threads-batch
        -C --cpu-mask
        -Cr --cpu-range
        --cpu-strict
        --prio
        --poll
        -Cb --cpu-mask-batch
        -Crb --cpu-range-batch
        --cpu-strict-batch
        --prio-batch
        --poll-batch
        -c --ctx-size
        -n --predict --n-predict
        -b --batch-size
        -ub --ubatch-size
        --keep
        --swa-full
        -fa --flash-attn
        -p --prompt
        --perf
        -f --file
        -bf --binary-file
        -e --escape
        --rope-scaling
        --rope-scale
        --rope-freq-base
        --rope-freq-scale
        --yarn-orig-ctx
        --yarn-ext-factor
        --yarn-attn-factor
        --yarn-beta-slow
        --yarn-beta-fast
        -kvo --kv-offload
        --repack
        --no-host
        -ctk --cache-type-k
        -ctv --cache-type-v
        -dt --defrag-thold
        -np --parallel
        --rpc
        -lm --load-mode
        -lzm --lazy-mode
        --numa
        -dev --device
        --list-devices
        -ot --override-tensor
        -cmoe --cpu-moe
        -ncmoe --n-cpu-moe
        --moe-cache-mib
        -ncffn --n-cpu-ffn
        -ngl --gpu-layers --n-gpu-layers
        -sm --split-mode
        -ts --tensor-split
        -mg --main-gpu
        -fit --fit
        -fitt --fit-target
        -fitc --fit-ctx
        --check-tensors
        --override-kv
        --op-offload
        --lora
        --lora-scaled
        --control-vector
        --control-vector-scaled
        --control-vector-layer-range
        -m --model
        -mu --model-url
        -dr --docker-repo
        -hf -hfr --hf-repo
        -hff --hf-file
        -hft --hf-token
        --log-disable
        --log-file
        --log-jsonl
        --log-colors
        -v --verbose --log-verbose
        --offline
        -lv --verbosity --log-verbosity
        --log-prefix
        --log-timestamps
        --spec-draft-type-k -ctkd --cache-type-k-draft
        --spec-draft-type-v -ctvd --cache-type-v-draft
        --samplers
        -s --seed
        --sampler-seq --sampling-seq
        --ignore-eos
        --temp --temperature
        --top-k
        --top-p
        --min-p
        --top-nsigma --top-n-sigma
        --xtc-probability
        --xtc-threshold
        --typical --typical-p
        --repeat-last-n
        --repeat-penalty
        --presence-penalty
        --frequency-penalty
        --dry-multiplier
        --dry-base
        --dry-allowed-length
        --dry-penalty-last-n
        --dry-sequence-breaker
        --adaptive-target
        --adaptive-decay
        --dynatemp-range
        --dynatemp-exp
        --mirostat
        --mirostat-lr
        --mirostat-ent
        -l --logit-bias
        --grammar
        --grammar-file
        -j --json-schema
        -jf --json-schema-file
        -bs --backend-sampling
        -sys --system-prompt
        -sysf --system-prompt-file
        --diffusion-steps
        --diffusion-visual
        --diffusion-eps
        --diffusion-algorithm
        --diffusion-alg-temp
        --diffusion-block-length
        --diffusion-cfg-scale
        --diffusion-add-gumbel-noise
    "

    case "$prev" in
        -h | --help | --usage )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print usage and exit"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --version )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
show version and build info"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -cl | --cache-list )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
show list of models in cache"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --completion-bash )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print source-able bash completion script for llama.cpp"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -t | --threads )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of CPU threads to use during generation (default: -1)
(env: LLAMA_ARG_THREADS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -tb | --threads-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of threads to use during batch and prompt processing (default: same as --threads)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -C | --cpu-mask )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
CPU affinity mask: arbitrarily long hex. Complements cpu-range (default: \"\")"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Cr | --cpu-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
range of CPUs for affinity. Complements --cpu-mask"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --cpu-strict )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use strict CPU placement (default: 0)
"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --prio )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set process/thread priority : low(-1), normal(0), medium(1), high(2), realtime(3) (default: 0)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --poll )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use polling level to wait for work (0 - no polling, default: 50)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Cb | --cpu-mask-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
CPU affinity mask: arbitrarily long hex. Complements cpu-range-batch (default: same as --cpu-mask)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Crb | --cpu-range-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ranges of CPUs for affinity. Complements --cpu-mask-batch"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --cpu-strict-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use strict CPU placement (default: same as --cpu-strict)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --prio-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set process/thread priority : 0-normal, 1-medium, 2-high, 3-realtime (default: 0)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --poll-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use polling to wait for work (default: same as --poll)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        -c | --ctx-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
size of the prompt context (default: 0, 0 = loaded from model)
(env: LLAMA_ARG_CTX_SIZE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -n | --predict | --n-predict )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of tokens to predict (default: -1, -1 = infinity)
(env: LLAMA_ARG_N_PREDICT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -b | --batch-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
logical maximum batch size (default: 2048)
(env: LLAMA_ARG_BATCH)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ub | --ubatch-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
physical maximum batch size (default: 512)
(env: LLAMA_ARG_UBATCH)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --keep )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of tokens to keep from the initial prompt (default: 0, -1 = all)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --swa-full )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fa | --flash-attn )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
set Flash Attention use ('on', 'off', or 'auto', default: 'auto')
(env: LLAMA_ARG_FLASH_ATTN)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        -p | --prompt )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
prompt to start generation with; for system message, use -sys"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --perf )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable internal libllama performance timings (default: false)
(env: LLAMA_ARG_PERF)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -f | --file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
a file containing the prompt (default: none)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -bf | --binary-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
binary file containing the prompt (default: none)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -e | --escape )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to process escapes sequences (\\n, \\r, \\t, \\', \\\", \\\\) (default: true)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-scaling )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
RoPE frequency scaling method, defaults to linear unless specified by the model
(env: LLAMA_ARG_ROPE_SCALING_TYPE)"
            fi
            COMPREPLY=( $(compgen -W 'none linear yarn' -- "$cur") )
            return 0
        ;;
        --rope-scale )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE context scaling factor, expands context by a factor of N
(env: LLAMA_ARG_ROPE_SCALE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-freq-base )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE base frequency, used by NTK-aware scaling (default: loaded from model)
(env: LLAMA_ARG_ROPE_FREQ_BASE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-freq-scale )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE frequency scaling factor, expands context by a factor of 1/N
(env: LLAMA_ARG_ROPE_FREQ_SCALE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-orig-ctx )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: original context size of model (default: 0 = model training context size)
(env: LLAMA_ARG_YARN_ORIG_CTX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-ext-factor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: extrapolation mix factor (default: -1.00, 0.0 = full interpolation)
(env: LLAMA_ARG_YARN_EXT_FACTOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-attn-factor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: scale sqrt(t) or attention magnitude (default: -1.00)
(env: LLAMA_ARG_YARN_ATTN_FACTOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-beta-slow )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: high correction dim or alpha (default: -1.00)
(env: LLAMA_ARG_YARN_BETA_SLOW)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-beta-fast )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: low correction dim or beta (default: -1.00)
(env: LLAMA_ARG_YARN_BETA_FAST)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -kvo | --kv-offload )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable KV cache offloading (default: enabled)
(env: LLAMA_ARG_KV_OFFLOAD)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repack )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable weight repacking (default: enabled)
(env: LLAMA_ARG_REPACK)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --no-host )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
bypass host buffer allowing extra buffers to be used
(env: LLAMA_ARG_NO_HOST)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ctk | --cache-type-k )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ctv | --cache-type-v )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -dt | --defrag-thold )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
KV cache defragmentation threshold (DEPRECATED)
(env: LLAMA_ARG_DEFRAG_THOLD)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -np | --parallel )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of parallel sequences to decode (default: 1)
(env: LLAMA_ARG_N_PARALLEL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rpc )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
comma-separated list of RPC servers (host:port)
(env: LLAMA_ARG_RPC)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -lm | --load-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
model loading mode (default: auto)
- 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)"
            fi
            COMPREPLY=( $(compgen -W 'auto none mmap mlock mmap+mlock dio' -- "$cur") )
            return 0
        ;;
        -lzm | --lazy-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
on-demand reading of certain tensors, for example per-layer embeddings (default: auto)
- on: read the rows of such tensors from disk on demand instead of keeping them resident (requires mmap)
- auto: on, but only for tensors larger than 4 GiB
- off: always keep them resident
(env: LLAMA_ARG_LAZY_MODE)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        --numa )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
attempt optimizations that help on some NUMA systems
- 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)"
            fi
            COMPREPLY=( $(compgen -W 'distribute isolate numactl' -- "$cur") )
            return 0
        ;;
        -dev | --device )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --list-devices )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print list of available devices and exit"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ot | --override-tensor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
override tensor buffer type
(env: LLAMA_ARG_OVERRIDE_TENSOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -cmoe | --cpu-moe )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep all Mixture of Experts (MoE) weights in the CPU
(env: LLAMA_ARG_CPU_MOE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ncmoe | --n-cpu-moe )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep the Mixture of Experts (MoE) weights of the first N layers in the CPU
(env: LLAMA_ARG_N_CPU_MOE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --moe-cache-mib )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
GPU cache size in MiB for the MoE experts kept in the CPU. with multiple GPUs, it is split among them like the layers (--tensor-split) (default: 0, disabled)
(env: LLAMA_ARG_MOE_CACHE_MIB)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ncffn | --n-cpu-ffn )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep the dense FFN weights of the first N layers in the CPU
(dense models; for MoE expert weights use --n-cpu-moe)
(env: LLAMA_ARG_N_CPU_FFN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ngl | --gpu-layers | --n-gpu-layers )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
max. number of layers to store in VRAM, either an exact number, 'auto', or 'all' (default: auto)
(env: LLAMA_ARG_N_GPU_LAYERS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -sm | --split-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
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)"
            fi
            COMPREPLY=( $(compgen -W 'none layer row split' -- "$cur") )
            return 0
        ;;
        -ts | --tensor-split )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
fraction of the model to offload to each GPU, comma-separated list of proportions, e.g. 3,1
(env: LLAMA_ARG_TENSOR_SPLIT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -mg | --main-gpu )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fit | --fit )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
whether to adjust unset arguments to fit in device memory ('on' or 'off', default: 'on')
(env: LLAMA_ARG_FIT)"
            fi
            COMPREPLY=( $(compgen -W 'on off' -- "$cur") )
            return 0
        ;;
        -fitt | --fit-target )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fitc | --fit-ctx )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
minimum ctx size that can be set by --fit option, default: 4096
(env: LLAMA_ARG_FIT_CTX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --check-tensors )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
check model tensor data for invalid values (default: false)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --override-kv )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --op-offload )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to offload host tensor operations to device (default: true)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --lora )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to LoRA adapter (use comma-separated values to load multiple adapters)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --lora-scaled )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to LoRA adapter with user defined scaling (format: FNAME:SCALE,...)
note: use comma-separated values"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add a control vector
note: use comma-separated values to add multiple control vectors"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector-scaled )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add a control vector with user defined scaling SCALE
note: use comma-separated values (format: FNAME:SCALE,...)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector-layer-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
layer range to apply the control vector(s) to, start and end inclusive"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -m | --model )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
model path to load
(env: LLAMA_ARG_MODEL)"
            fi
            COMPREPLY=( $(compgen -f -X '!*.gguf' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -mu | --model-url )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
model download url (default: unused)
(env: LLAMA_ARG_MODEL_URL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -dr | --docker-repo )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Docker Hub model repository. repo is optional, default to ai/. quant is optional, default to :latest.
example: gemma3
(default: unused)
(env: LLAMA_ARG_DOCKER_REPO)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hf | -hfr | --hf-repo )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face model repository; quant is optional, case-insensitive, default to Q4_K_M, or falls back to the first file in the repo if Q4_K_M doesn't exist.
mmproj is also downloaded automatically if available. to disable, add --no-mmproj
example: ggml-org/GLM-4.7-Flash-GGUF:Q4_K_M
(default: unused)
(env: LLAMA_ARG_HF_REPO)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hff | --hf-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face model file. If specified, it will override the quant in --hf-repo (default: unused)
(env: LLAMA_ARG_HF_FILE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hft | --hf-token )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face access token (default: value from HF_TOKEN environment variable)
(env: HF_TOKEN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-disable )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log disable"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log to file
(env: LLAMA_ARG_LOG_FILE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-jsonl )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log as JSONL (one JSON object per line) to stdout, this also disables colored logging (default: disabled)
(env: LLAMA_ARG_LOG_JSONL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-colors )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
Set colored logging ('on', 'off', or 'auto', default: 'auto')
'auto' enables colors when output is to a terminal
(env: LLAMA_ARG_LOG_COLORS)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        -v | --verbose | --log-verbose )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Set verbosity level to infinity (i.e. log all messages, useful for debugging)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --offline )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Offline mode: forces use of cache, prevents network access
(env: LLAMA_ARG_OFFLINE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -lv | --verbosity | --log-verbosity )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Set the verbosity threshold. Messages with a higher verbosity will be ignored. Values:
 - 0: generic output
 - 1: error
 - 2: warning
 - 3: info
 - 4: trace (more info)
 - 5: debug
(default: 3)

(env: LLAMA_ARG_LOG_VERBOSITY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-prefix )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Enable prefix in log messages
(env: LLAMA_ARG_LOG_PREFIX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-timestamps )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Enable timestamps in log messages
(env: LLAMA_ARG_LOG_TIMESTAMPS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-type-k | -ctkd | --cache-type-k-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-type-v | -ctvd | --cache-type-v-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
KV cache data type for V 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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --samplers )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
samplers that will be used for generation in the order, separated by ';'
(default: penalties;dry;top_n_sigma;top_k;typ_p;top_p;min_p;xtc;temperature)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -s | --seed )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RNG seed (default: -1, use random seed for -1)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --sampler-seq | --sampling-seq )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
simplified sequence for samplers that will be used (default: edskypmxt)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --ignore-eos )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ignore end of stream token and continue generating (implies --logit-bias EOS-inf)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --temp | --temperature )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
temperature (default: 0.80)
(env: LLAMA_ARG_TEMPERATURE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-k )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-k sampling (default: 40, 0 = disabled)
(env: LLAMA_ARG_TOP_K)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-p sampling (default: 0.95, 1.0 = disabled)
(env: LLAMA_ARG_TOP_P)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --min-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
min-p sampling (default: 0.05, 0.0 = disabled)
(env: LLAMA_ARG_MIN_P)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-nsigma | --top-n-sigma )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-n-sigma sampling (default: -1.00, -1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --xtc-probability )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
xtc probability (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --xtc-threshold )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
xtc threshold (default: 0.10, 1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --typical | --typical-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
locally typical sampling, parameter p (default: 1.00, 1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repeat-last-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
last n tokens to consider for penalize (default: 64, 0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repeat-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
penalize repeat sequence of tokens (default: 1.00, 1.0 = disabled)
(env: LLAMA_ARG_REPEAT_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --presence-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
repeat alpha presence penalty (default: 0.00, 0.0 = disabled)
(env: LLAMA_ARG_PRESENCE_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --frequency-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
repeat alpha frequency penalty (default: 0.00, 0.0 = disabled)
(env: LLAMA_ARG_FREQUENCY_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-multiplier )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY sampling multiplier (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-base )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY sampling base value (default: 1.75)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-allowed-length )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set allowed length for DRY sampling (default: 2)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-penalty-last-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY penalty for the last n tokens (default: 64, 0 = disable)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-sequence-breaker )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add sequence breaker for DRY sampling, clearing out default breakers ('\\n', ':', '\"', '*') in the process; use \"none\" to not use any sequence breakers
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --adaptive-target )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
adaptive-p: select tokens near this probability (valid range 0.0 to 1.0; negative = disabled) (default: -1.00)
[(more info)](https://github.com/ggml-org/llama.cpp/pull/17927)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --adaptive-decay )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
adaptive-p: 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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dynatemp-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
dynamic temperature range (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dynatemp-exp )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
dynamic temperature exponent (default: 1.00)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use Mirostat sampling.
Top K, Nucleus and Locally Typical samplers are ignored if used.
(default: 0, 0 = disabled, 1 = Mirostat, 2 = Mirostat 2.0)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat-lr )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Mirostat learning rate, parameter eta (default: 0.10)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat-ent )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Mirostat target entropy, parameter tau (default: 5.00)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -l | --logit-bias )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
modifies the likelihood of token appearing in the completion,
i.e. \`--logit-bias 15043+1\` to increase likelihood of token ' Hello',
or \`--logit-bias 15043-1\` to decrease likelihood of token ' Hello'"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --grammar )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
BNF-like grammar to constrain generations (see samples in grammars/ dir)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --grammar-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
file to read grammar from"
            fi
            COMPREPLY=( $(compgen -f -X '!*.gbnf' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -j | --json-schema )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
JSON schema to constrain generations (https://json-schema.org/), e.g. \`{\"type\": \"object\"}\` for any JSON object"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -jf | --json-schema-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
File containing a JSON schema to constrain generations (https://json-schema.org/), e.g. \`{\"type\": \"object\"}\` for any JSON object"
            fi
            COMPREPLY=( $(compgen -f -X '!*.json' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -bs | --backend-sampling )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
enable backend sampling (experimental) (default: disabled)
(env: LLAMA_ARG_BACKEND_SAMPLING)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -sys | --system-prompt )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
system prompt to use with model (if applicable, depending on chat template)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -sysf | --system-prompt-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
a file containing the system prompt (default: none)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --diffusion-steps )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of diffusion steps (default: 128)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --diffusion-visual )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
enable visual diffusion mode (show progressive generation) (default: false)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --diffusion-eps )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
epsilon for timesteps (default: 0.000000)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --diffusion-algorithm )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
diffusion algorithm: 0=DIFFUSION_ALGORITHM_ORIGIN, 1=DIFFUSION_ALGORITHM_ENTROPY_BASED, 2=DIFFUSION_ALGORITHM_MARGIN_BASED, 3=DIFFUSION_ALGORITHM_RANDOM, 4=DIFFUSION_ALGORITHM_CONFIDENCE_BASED (default: 4)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --diffusion-alg-temp )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
dream algorithm temperature (default: 0.000)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --diffusion-block-length )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
llada block length for generation (default: 0)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --diffusion-cfg-scale )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
llada classifier-free guidance scale (default: 0.000)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --diffusion-add-gumbel-noise )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add gumbel noise to the logits if temp > 0.0 (default: false)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
    esac

case "$curr" in
    -* )
        COMPREPLY=( $(compgen -W "${opts}" -- "$curr") )
        return 0
    ;;
esac
} && complete -F _comp_cmd_llama_diffusion_cli llama-diffusion-cli

_comp_cmd_llama_embedding()
{
    local curr prev opts
    COMPREPLY=()
    curr="${COMP_WORDS[COMP_CWORD]}"
    prev="${COMP_WORDS[COMP_CWORD-1]}"

    opts="
        -h --help --usage
        --version
        -cl --cache-list
        --completion-bash
        -t --threads
        -tb --threads-batch
        -C --cpu-mask
        -Cr --cpu-range
        --cpu-strict
        --prio
        --poll
        -Cb --cpu-mask-batch
        -Crb --cpu-range-batch
        --cpu-strict-batch
        --prio-batch
        --poll-batch
        -c --ctx-size
        -n --predict --n-predict
        -b --batch-size
        -ub --ubatch-size
        --keep
        --swa-full
        -fa --flash-attn
        -p --prompt
        --perf
        -f --file
        -bf --binary-file
        -e --escape
        --rope-scaling
        --rope-scale
        --rope-freq-base
        --rope-freq-scale
        --yarn-orig-ctx
        --yarn-ext-factor
        --yarn-attn-factor
        --yarn-beta-slow
        --yarn-beta-fast
        -kvo --kv-offload
        --repack
        --no-host
        -ctk --cache-type-k
        -ctv --cache-type-v
        -dt --defrag-thold
        -np --parallel
        --rpc
        -lm --load-mode
        -lzm --lazy-mode
        --numa
        -dev --device
        --list-devices
        -ot --override-tensor
        -cmoe --cpu-moe
        -ncmoe --n-cpu-moe
        --moe-cache-mib
        -ncffn --n-cpu-ffn
        -ngl --gpu-layers --n-gpu-layers
        -sm --split-mode
        -ts --tensor-split
        -mg --main-gpu
        -fit --fit
        -fitt --fit-target
        -fitc --fit-ctx
        --check-tensors
        --override-kv
        --op-offload
        --lora
        --lora-scaled
        --control-vector
        --control-vector-scaled
        --control-vector-layer-range
        -m --model
        -mu --model-url
        -dr --docker-repo
        -hf -hfr --hf-repo
        -hff --hf-file
        -hft --hf-token
        --log-disable
        --log-file
        --log-jsonl
        --log-colors
        -v --verbose --log-verbose
        --offline
        -lv --verbosity --log-verbosity
        --log-prefix
        --log-timestamps
        --spec-draft-type-k -ctkd --cache-type-k-draft
        --spec-draft-type-v -ctvd --cache-type-v-draft
        --samplers
        -s --seed
        --sampler-seq --sampling-seq
        --ignore-eos
        --temp --temperature
        --top-k
        --top-p
        --min-p
        --top-nsigma --top-n-sigma
        --xtc-probability
        --xtc-threshold
        --typical --typical-p
        --repeat-last-n
        --repeat-penalty
        --presence-penalty
        --frequency-penalty
        --dry-multiplier
        --dry-base
        --dry-allowed-length
        --dry-penalty-last-n
        --dry-sequence-breaker
        --adaptive-target
        --adaptive-decay
        --dynatemp-range
        --dynatemp-exp
        --mirostat
        --mirostat-lr
        --mirostat-ent
        -l --logit-bias
        --grammar
        --grammar-file
        -j --json-schema
        -jf --json-schema-file
        -bs --backend-sampling
        --verbose-prompt
        --warmup
        --pooling
        --attention
        --embd-normalize
        --embd-output-format
        --embd-separator
        --cls-separator
        --embd-gemma-default
    "

    case "$prev" in
        -h | --help | --usage )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print usage and exit"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --version )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
show version and build info"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -cl | --cache-list )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
show list of models in cache"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --completion-bash )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print source-able bash completion script for llama.cpp"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -t | --threads )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of CPU threads to use during generation (default: -1)
(env: LLAMA_ARG_THREADS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -tb | --threads-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of threads to use during batch and prompt processing (default: same as --threads)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -C | --cpu-mask )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
CPU affinity mask: arbitrarily long hex. Complements cpu-range (default: \"\")"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Cr | --cpu-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
range of CPUs for affinity. Complements --cpu-mask"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --cpu-strict )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use strict CPU placement (default: 0)
"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --prio )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set process/thread priority : low(-1), normal(0), medium(1), high(2), realtime(3) (default: 0)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --poll )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use polling level to wait for work (0 - no polling, default: 50)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Cb | --cpu-mask-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
CPU affinity mask: arbitrarily long hex. Complements cpu-range-batch (default: same as --cpu-mask)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Crb | --cpu-range-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ranges of CPUs for affinity. Complements --cpu-mask-batch"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --cpu-strict-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use strict CPU placement (default: same as --cpu-strict)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --prio-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set process/thread priority : 0-normal, 1-medium, 2-high, 3-realtime (default: 0)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --poll-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use polling to wait for work (default: same as --poll)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        -c | --ctx-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
size of the prompt context (default: 0, 0 = loaded from model)
(env: LLAMA_ARG_CTX_SIZE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -n | --predict | --n-predict )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of tokens to predict (default: -1, -1 = infinity)
(env: LLAMA_ARG_N_PREDICT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -b | --batch-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
logical maximum batch size (default: 2048)
(env: LLAMA_ARG_BATCH)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ub | --ubatch-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
physical maximum batch size (default: 512)
(env: LLAMA_ARG_UBATCH)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --keep )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of tokens to keep from the initial prompt (default: 0, -1 = all)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --swa-full )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fa | --flash-attn )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
set Flash Attention use ('on', 'off', or 'auto', default: 'auto')
(env: LLAMA_ARG_FLASH_ATTN)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        -p | --prompt )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
prompt to start generation with; for system message, use -sys"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --perf )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable internal libllama performance timings (default: false)
(env: LLAMA_ARG_PERF)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -f | --file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
a file containing the prompt (default: none)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -bf | --binary-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
binary file containing the prompt (default: none)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -e | --escape )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to process escapes sequences (\\n, \\r, \\t, \\', \\\", \\\\) (default: true)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-scaling )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
RoPE frequency scaling method, defaults to linear unless specified by the model
(env: LLAMA_ARG_ROPE_SCALING_TYPE)"
            fi
            COMPREPLY=( $(compgen -W 'none linear yarn' -- "$cur") )
            return 0
        ;;
        --rope-scale )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE context scaling factor, expands context by a factor of N
(env: LLAMA_ARG_ROPE_SCALE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-freq-base )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE base frequency, used by NTK-aware scaling (default: loaded from model)
(env: LLAMA_ARG_ROPE_FREQ_BASE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-freq-scale )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE frequency scaling factor, expands context by a factor of 1/N
(env: LLAMA_ARG_ROPE_FREQ_SCALE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-orig-ctx )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: original context size of model (default: 0 = model training context size)
(env: LLAMA_ARG_YARN_ORIG_CTX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-ext-factor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: extrapolation mix factor (default: -1.00, 0.0 = full interpolation)
(env: LLAMA_ARG_YARN_EXT_FACTOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-attn-factor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: scale sqrt(t) or attention magnitude (default: -1.00)
(env: LLAMA_ARG_YARN_ATTN_FACTOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-beta-slow )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: high correction dim or alpha (default: -1.00)
(env: LLAMA_ARG_YARN_BETA_SLOW)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-beta-fast )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: low correction dim or beta (default: -1.00)
(env: LLAMA_ARG_YARN_BETA_FAST)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -kvo | --kv-offload )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable KV cache offloading (default: enabled)
(env: LLAMA_ARG_KV_OFFLOAD)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repack )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable weight repacking (default: enabled)
(env: LLAMA_ARG_REPACK)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --no-host )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
bypass host buffer allowing extra buffers to be used
(env: LLAMA_ARG_NO_HOST)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ctk | --cache-type-k )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ctv | --cache-type-v )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -dt | --defrag-thold )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
KV cache defragmentation threshold (DEPRECATED)
(env: LLAMA_ARG_DEFRAG_THOLD)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -np | --parallel )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of parallel sequences to decode (default: 1)
(env: LLAMA_ARG_N_PARALLEL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rpc )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
comma-separated list of RPC servers (host:port)
(env: LLAMA_ARG_RPC)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -lm | --load-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
model loading mode (default: auto)
- 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)"
            fi
            COMPREPLY=( $(compgen -W 'auto none mmap mlock mmap+mlock dio' -- "$cur") )
            return 0
        ;;
        -lzm | --lazy-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
on-demand reading of certain tensors, for example per-layer embeddings (default: auto)
- on: read the rows of such tensors from disk on demand instead of keeping them resident (requires mmap)
- auto: on, but only for tensors larger than 4 GiB
- off: always keep them resident
(env: LLAMA_ARG_LAZY_MODE)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        --numa )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
attempt optimizations that help on some NUMA systems
- 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)"
            fi
            COMPREPLY=( $(compgen -W 'distribute isolate numactl' -- "$cur") )
            return 0
        ;;
        -dev | --device )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --list-devices )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print list of available devices and exit"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ot | --override-tensor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
override tensor buffer type
(env: LLAMA_ARG_OVERRIDE_TENSOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -cmoe | --cpu-moe )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep all Mixture of Experts (MoE) weights in the CPU
(env: LLAMA_ARG_CPU_MOE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ncmoe | --n-cpu-moe )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep the Mixture of Experts (MoE) weights of the first N layers in the CPU
(env: LLAMA_ARG_N_CPU_MOE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --moe-cache-mib )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
GPU cache size in MiB for the MoE experts kept in the CPU. with multiple GPUs, it is split among them like the layers (--tensor-split) (default: 0, disabled)
(env: LLAMA_ARG_MOE_CACHE_MIB)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ncffn | --n-cpu-ffn )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep the dense FFN weights of the first N layers in the CPU
(dense models; for MoE expert weights use --n-cpu-moe)
(env: LLAMA_ARG_N_CPU_FFN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ngl | --gpu-layers | --n-gpu-layers )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
max. number of layers to store in VRAM, either an exact number, 'auto', or 'all' (default: auto)
(env: LLAMA_ARG_N_GPU_LAYERS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -sm | --split-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
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)"
            fi
            COMPREPLY=( $(compgen -W 'none layer row split' -- "$cur") )
            return 0
        ;;
        -ts | --tensor-split )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
fraction of the model to offload to each GPU, comma-separated list of proportions, e.g. 3,1
(env: LLAMA_ARG_TENSOR_SPLIT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -mg | --main-gpu )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fit | --fit )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
whether to adjust unset arguments to fit in device memory ('on' or 'off', default: 'on')
(env: LLAMA_ARG_FIT)"
            fi
            COMPREPLY=( $(compgen -W 'on off' -- "$cur") )
            return 0
        ;;
        -fitt | --fit-target )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fitc | --fit-ctx )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
minimum ctx size that can be set by --fit option, default: 4096
(env: LLAMA_ARG_FIT_CTX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --check-tensors )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
check model tensor data for invalid values (default: false)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --override-kv )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --op-offload )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to offload host tensor operations to device (default: true)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --lora )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to LoRA adapter (use comma-separated values to load multiple adapters)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --lora-scaled )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to LoRA adapter with user defined scaling (format: FNAME:SCALE,...)
note: use comma-separated values"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add a control vector
note: use comma-separated values to add multiple control vectors"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector-scaled )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add a control vector with user defined scaling SCALE
note: use comma-separated values (format: FNAME:SCALE,...)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector-layer-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
layer range to apply the control vector(s) to, start and end inclusive"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -m | --model )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
model path to load
(env: LLAMA_ARG_MODEL)"
            fi
            COMPREPLY=( $(compgen -f -X '!*.gguf' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -mu | --model-url )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
model download url (default: unused)
(env: LLAMA_ARG_MODEL_URL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -dr | --docker-repo )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Docker Hub model repository. repo is optional, default to ai/. quant is optional, default to :latest.
example: gemma3
(default: unused)
(env: LLAMA_ARG_DOCKER_REPO)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hf | -hfr | --hf-repo )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face model repository; quant is optional, case-insensitive, default to Q4_K_M, or falls back to the first file in the repo if Q4_K_M doesn't exist.
mmproj is also downloaded automatically if available. to disable, add --no-mmproj
example: ggml-org/GLM-4.7-Flash-GGUF:Q4_K_M
(default: unused)
(env: LLAMA_ARG_HF_REPO)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hff | --hf-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face model file. If specified, it will override the quant in --hf-repo (default: unused)
(env: LLAMA_ARG_HF_FILE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hft | --hf-token )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face access token (default: value from HF_TOKEN environment variable)
(env: HF_TOKEN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-disable )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log disable"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log to file
(env: LLAMA_ARG_LOG_FILE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-jsonl )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log as JSONL (one JSON object per line) to stdout, this also disables colored logging (default: disabled)
(env: LLAMA_ARG_LOG_JSONL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-colors )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
Set colored logging ('on', 'off', or 'auto', default: 'auto')
'auto' enables colors when output is to a terminal
(env: LLAMA_ARG_LOG_COLORS)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        -v | --verbose | --log-verbose )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Set verbosity level to infinity (i.e. log all messages, useful for debugging)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --offline )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Offline mode: forces use of cache, prevents network access
(env: LLAMA_ARG_OFFLINE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -lv | --verbosity | --log-verbosity )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Set the verbosity threshold. Messages with a higher verbosity will be ignored. Values:
 - 0: generic output
 - 1: error
 - 2: warning
 - 3: info
 - 4: trace (more info)
 - 5: debug
(default: 3)

(env: LLAMA_ARG_LOG_VERBOSITY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-prefix )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Enable prefix in log messages
(env: LLAMA_ARG_LOG_PREFIX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-timestamps )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Enable timestamps in log messages
(env: LLAMA_ARG_LOG_TIMESTAMPS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-type-k | -ctkd | --cache-type-k-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-type-v | -ctvd | --cache-type-v-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
KV cache data type for V 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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --samplers )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
samplers that will be used for generation in the order, separated by ';'
(default: penalties;dry;top_n_sigma;top_k;typ_p;top_p;min_p;xtc;temperature)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -s | --seed )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RNG seed (default: -1, use random seed for -1)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --sampler-seq | --sampling-seq )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
simplified sequence for samplers that will be used (default: edskypmxt)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --ignore-eos )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ignore end of stream token and continue generating (implies --logit-bias EOS-inf)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --temp | --temperature )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
temperature (default: 0.80)
(env: LLAMA_ARG_TEMPERATURE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-k )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-k sampling (default: 40, 0 = disabled)
(env: LLAMA_ARG_TOP_K)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-p sampling (default: 0.95, 1.0 = disabled)
(env: LLAMA_ARG_TOP_P)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --min-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
min-p sampling (default: 0.05, 0.0 = disabled)
(env: LLAMA_ARG_MIN_P)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-nsigma | --top-n-sigma )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-n-sigma sampling (default: -1.00, -1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --xtc-probability )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
xtc probability (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --xtc-threshold )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
xtc threshold (default: 0.10, 1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --typical | --typical-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
locally typical sampling, parameter p (default: 1.00, 1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repeat-last-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
last n tokens to consider for penalize (default: 64, 0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repeat-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
penalize repeat sequence of tokens (default: 1.00, 1.0 = disabled)
(env: LLAMA_ARG_REPEAT_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --presence-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
repeat alpha presence penalty (default: 0.00, 0.0 = disabled)
(env: LLAMA_ARG_PRESENCE_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --frequency-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
repeat alpha frequency penalty (default: 0.00, 0.0 = disabled)
(env: LLAMA_ARG_FREQUENCY_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-multiplier )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY sampling multiplier (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-base )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY sampling base value (default: 1.75)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-allowed-length )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set allowed length for DRY sampling (default: 2)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-penalty-last-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY penalty for the last n tokens (default: 64, 0 = disable)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-sequence-breaker )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add sequence breaker for DRY sampling, clearing out default breakers ('\\n', ':', '\"', '*') in the process; use \"none\" to not use any sequence breakers
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --adaptive-target )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
adaptive-p: select tokens near this probability (valid range 0.0 to 1.0; negative = disabled) (default: -1.00)
[(more info)](https://github.com/ggml-org/llama.cpp/pull/17927)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --adaptive-decay )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
adaptive-p: 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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dynatemp-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
dynamic temperature range (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dynatemp-exp )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
dynamic temperature exponent (default: 1.00)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use Mirostat sampling.
Top K, Nucleus and Locally Typical samplers are ignored if used.
(default: 0, 0 = disabled, 1 = Mirostat, 2 = Mirostat 2.0)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat-lr )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Mirostat learning rate, parameter eta (default: 0.10)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat-ent )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Mirostat target entropy, parameter tau (default: 5.00)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -l | --logit-bias )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
modifies the likelihood of token appearing in the completion,
i.e. \`--logit-bias 15043+1\` to increase likelihood of token ' Hello',
or \`--logit-bias 15043-1\` to decrease likelihood of token ' Hello'"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --grammar )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
BNF-like grammar to constrain generations (see samples in grammars/ dir)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --grammar-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
file to read grammar from"
            fi
            COMPREPLY=( $(compgen -f -X '!*.gbnf' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -j | --json-schema )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
JSON schema to constrain generations (https://json-schema.org/), e.g. \`{\"type\": \"object\"}\` for any JSON object"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -jf | --json-schema-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
File containing a JSON schema to constrain generations (https://json-schema.org/), e.g. \`{\"type\": \"object\"}\` for any JSON object"
            fi
            COMPREPLY=( $(compgen -f -X '!*.json' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -bs | --backend-sampling )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
enable backend sampling (experimental) (default: disabled)
(env: LLAMA_ARG_BACKEND_SAMPLING)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --verbose-prompt )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print a verbose prompt before generation (default: false)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --warmup )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to perform warmup with an empty run (default: enabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --pooling )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
pooling type for embeddings, use model default if unspecified
(env: LLAMA_ARG_POOLING)"
            fi
            COMPREPLY=( $(compgen -W 'none mean cls last rank' -- "$cur") )
            return 0
        ;;
        --attention )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
attention type for embeddings, use model default if unspecified"
            fi
            COMPREPLY=( $(compgen -W 'causal non-causal' -- "$cur") )
            return 0
        ;;
        --embd-normalize )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
normalisation for embeddings (default: 2) (-1=none, 0=max absolute int16, 1=taxicab, 2=euclidean, >2=p-norm)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --embd-output-format )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
empty = default, \"array\" = [[],[]...], \"json\" = openai style, \"json+\" = same \"json\" + cosine similarity matrix, \"raw\" = plain whitespace-delimited output (one embedding per line)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --embd-separator )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
separator of embeddings (default \\n) for example \"<#sep#>\""
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --cls-separator )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
separator of classification sequences (default \\t) for example \"<#seq#>\""
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --embd-gemma-default )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use default EmbeddingGemma model (note: can download weights from the internet)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
    esac

case "$curr" in
    -* )
        COMPREPLY=( $(compgen -W "${opts}" -- "$curr") )
        return 0
    ;;
esac
} && complete -F _comp_cmd_llama_embedding llama-embedding

_comp_cmd_llama_eval_callback()
{
    local curr prev opts
    COMPREPLY=()
    curr="${COMP_WORDS[COMP_CWORD]}"
    prev="${COMP_WORDS[COMP_CWORD-1]}"

    opts="
        --samplers
        -s --seed
        --sampler-seq --sampling-seq
        --ignore-eos
        --temp --temperature
        --top-k
        --top-p
        --min-p
        --top-nsigma --top-n-sigma
        --xtc-probability
        --xtc-threshold
        --typical --typical-p
        --repeat-last-n
        --repeat-penalty
        --presence-penalty
        --frequency-penalty
        --dry-multiplier
        --dry-base
        --dry-allowed-length
        --dry-penalty-last-n
        --dry-sequence-breaker
        --adaptive-target
        --adaptive-decay
        --dynatemp-range
        --dynatemp-exp
        --mirostat
        --mirostat-lr
        --mirostat-ent
        -l --logit-bias
        --grammar
        --grammar-file
        -j --json-schema
        -jf --json-schema-file
        -bs --backend-sampling
        -h --help --usage
        --version
        -cl --cache-list
        --completion-bash
        -t --threads
        -tb --threads-batch
        -C --cpu-mask
        -Cr --cpu-range
        --cpu-strict
        --prio
        --poll
        -Cb --cpu-mask-batch
        -Crb --cpu-range-batch
        --cpu-strict-batch
        --prio-batch
        --poll-batch
        -c --ctx-size
        -n --predict --n-predict
        -b --batch-size
        -ub --ubatch-size
        --keep
        --swa-full
        -fa --flash-attn
        -p --prompt
        --perf
        -f --file
        -bf --binary-file
        -e --escape
        --rope-scaling
        --rope-scale
        --rope-freq-base
        --rope-freq-scale
        --yarn-orig-ctx
        --yarn-ext-factor
        --yarn-attn-factor
        --yarn-beta-slow
        --yarn-beta-fast
        -kvo --kv-offload
        --repack
        --no-host
        -ctk --cache-type-k
        -ctv --cache-type-v
        -dt --defrag-thold
        -np --parallel
        --rpc
        -lm --load-mode
        -lzm --lazy-mode
        --numa
        -dev --device
        --list-devices
        -ot --override-tensor
        -cmoe --cpu-moe
        -ncmoe --n-cpu-moe
        --moe-cache-mib
        -ncffn --n-cpu-ffn
        -ngl --gpu-layers --n-gpu-layers
        -sm --split-mode
        -ts --tensor-split
        -mg --main-gpu
        -fit --fit
        -fitt --fit-target
        -fitc --fit-ctx
        --check-tensors
        --override-kv
        --op-offload
        --lora
        --lora-scaled
        --control-vector
        --control-vector-scaled
        --control-vector-layer-range
        -m --model
        -mu --model-url
        -dr --docker-repo
        -hf -hfr --hf-repo
        -hff --hf-file
        -hft --hf-token
        --log-disable
        --log-file
        --log-jsonl
        --log-colors
        -v --verbose --log-verbose
        --offline
        -lv --verbosity --log-verbosity
        --log-prefix
        --log-timestamps
        --spec-draft-type-k -ctkd --cache-type-k-draft
        --spec-draft-type-v -ctvd --cache-type-v-draft
    "

    case "$prev" in
        --samplers )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
samplers that will be used for generation in the order, separated by ';'
(default: penalties;dry;top_n_sigma;top_k;typ_p;top_p;min_p;xtc;temperature)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -s | --seed )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RNG seed (default: -1, use random seed for -1)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --sampler-seq | --sampling-seq )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
simplified sequence for samplers that will be used (default: edskypmxt)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --ignore-eos )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ignore end of stream token and continue generating (implies --logit-bias EOS-inf)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --temp | --temperature )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
temperature (default: 0.80)
(env: LLAMA_ARG_TEMPERATURE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-k )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-k sampling (default: 40, 0 = disabled)
(env: LLAMA_ARG_TOP_K)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-p sampling (default: 0.95, 1.0 = disabled)
(env: LLAMA_ARG_TOP_P)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --min-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
min-p sampling (default: 0.05, 0.0 = disabled)
(env: LLAMA_ARG_MIN_P)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-nsigma | --top-n-sigma )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-n-sigma sampling (default: -1.00, -1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --xtc-probability )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
xtc probability (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --xtc-threshold )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
xtc threshold (default: 0.10, 1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --typical | --typical-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
locally typical sampling, parameter p (default: 1.00, 1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repeat-last-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
last n tokens to consider for penalize (default: 64, 0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repeat-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
penalize repeat sequence of tokens (default: 1.00, 1.0 = disabled)
(env: LLAMA_ARG_REPEAT_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --presence-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
repeat alpha presence penalty (default: 0.00, 0.0 = disabled)
(env: LLAMA_ARG_PRESENCE_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --frequency-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
repeat alpha frequency penalty (default: 0.00, 0.0 = disabled)
(env: LLAMA_ARG_FREQUENCY_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-multiplier )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY sampling multiplier (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-base )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY sampling base value (default: 1.75)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-allowed-length )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set allowed length for DRY sampling (default: 2)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-penalty-last-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY penalty for the last n tokens (default: 64, 0 = disable)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-sequence-breaker )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add sequence breaker for DRY sampling, clearing out default breakers ('\\n', ':', '\"', '*') in the process; use \"none\" to not use any sequence breakers
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --adaptive-target )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
adaptive-p: select tokens near this probability (valid range 0.0 to 1.0; negative = disabled) (default: -1.00)
[(more info)](https://github.com/ggml-org/llama.cpp/pull/17927)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --adaptive-decay )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
adaptive-p: 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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dynatemp-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
dynamic temperature range (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dynatemp-exp )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
dynamic temperature exponent (default: 1.00)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use Mirostat sampling.
Top K, Nucleus and Locally Typical samplers are ignored if used.
(default: 0, 0 = disabled, 1 = Mirostat, 2 = Mirostat 2.0)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat-lr )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Mirostat learning rate, parameter eta (default: 0.10)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat-ent )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Mirostat target entropy, parameter tau (default: 5.00)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -l | --logit-bias )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
modifies the likelihood of token appearing in the completion,
i.e. \`--logit-bias 15043+1\` to increase likelihood of token ' Hello',
or \`--logit-bias 15043-1\` to decrease likelihood of token ' Hello'"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --grammar )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
BNF-like grammar to constrain generations (see samples in grammars/ dir)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --grammar-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
file to read grammar from"
            fi
            COMPREPLY=( $(compgen -f -X '!*.gbnf' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -j | --json-schema )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
JSON schema to constrain generations (https://json-schema.org/), e.g. \`{\"type\": \"object\"}\` for any JSON object"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -jf | --json-schema-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
File containing a JSON schema to constrain generations (https://json-schema.org/), e.g. \`{\"type\": \"object\"}\` for any JSON object"
            fi
            COMPREPLY=( $(compgen -f -X '!*.json' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -bs | --backend-sampling )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
enable backend sampling (experimental) (default: disabled)
(env: LLAMA_ARG_BACKEND_SAMPLING)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -h | --help | --usage )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print usage and exit"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --version )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
show version and build info"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -cl | --cache-list )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
show list of models in cache"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --completion-bash )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print source-able bash completion script for llama.cpp"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -t | --threads )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of CPU threads to use during generation (default: -1)
(env: LLAMA_ARG_THREADS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -tb | --threads-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of threads to use during batch and prompt processing (default: same as --threads)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -C | --cpu-mask )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
CPU affinity mask: arbitrarily long hex. Complements cpu-range (default: \"\")"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Cr | --cpu-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
range of CPUs for affinity. Complements --cpu-mask"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --cpu-strict )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use strict CPU placement (default: 0)
"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --prio )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set process/thread priority : low(-1), normal(0), medium(1), high(2), realtime(3) (default: 0)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --poll )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use polling level to wait for work (0 - no polling, default: 50)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Cb | --cpu-mask-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
CPU affinity mask: arbitrarily long hex. Complements cpu-range-batch (default: same as --cpu-mask)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Crb | --cpu-range-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ranges of CPUs for affinity. Complements --cpu-mask-batch"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --cpu-strict-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use strict CPU placement (default: same as --cpu-strict)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --prio-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set process/thread priority : 0-normal, 1-medium, 2-high, 3-realtime (default: 0)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --poll-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use polling to wait for work (default: same as --poll)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        -c | --ctx-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
size of the prompt context (default: 0, 0 = loaded from model)
(env: LLAMA_ARG_CTX_SIZE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -n | --predict | --n-predict )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of tokens to predict (default: -1, -1 = infinity)
(env: LLAMA_ARG_N_PREDICT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -b | --batch-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
logical maximum batch size (default: 2048)
(env: LLAMA_ARG_BATCH)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ub | --ubatch-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
physical maximum batch size (default: 512)
(env: LLAMA_ARG_UBATCH)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --keep )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of tokens to keep from the initial prompt (default: 0, -1 = all)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --swa-full )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fa | --flash-attn )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
set Flash Attention use ('on', 'off', or 'auto', default: 'auto')
(env: LLAMA_ARG_FLASH_ATTN)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        -p | --prompt )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
prompt to start generation with; for system message, use -sys"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --perf )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable internal libllama performance timings (default: false)
(env: LLAMA_ARG_PERF)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -f | --file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
a file containing the prompt (default: none)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -bf | --binary-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
binary file containing the prompt (default: none)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -e | --escape )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to process escapes sequences (\\n, \\r, \\t, \\', \\\", \\\\) (default: true)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-scaling )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
RoPE frequency scaling method, defaults to linear unless specified by the model
(env: LLAMA_ARG_ROPE_SCALING_TYPE)"
            fi
            COMPREPLY=( $(compgen -W 'none linear yarn' -- "$cur") )
            return 0
        ;;
        --rope-scale )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE context scaling factor, expands context by a factor of N
(env: LLAMA_ARG_ROPE_SCALE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-freq-base )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE base frequency, used by NTK-aware scaling (default: loaded from model)
(env: LLAMA_ARG_ROPE_FREQ_BASE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-freq-scale )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE frequency scaling factor, expands context by a factor of 1/N
(env: LLAMA_ARG_ROPE_FREQ_SCALE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-orig-ctx )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: original context size of model (default: 0 = model training context size)
(env: LLAMA_ARG_YARN_ORIG_CTX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-ext-factor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: extrapolation mix factor (default: -1.00, 0.0 = full interpolation)
(env: LLAMA_ARG_YARN_EXT_FACTOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-attn-factor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: scale sqrt(t) or attention magnitude (default: -1.00)
(env: LLAMA_ARG_YARN_ATTN_FACTOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-beta-slow )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: high correction dim or alpha (default: -1.00)
(env: LLAMA_ARG_YARN_BETA_SLOW)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-beta-fast )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: low correction dim or beta (default: -1.00)
(env: LLAMA_ARG_YARN_BETA_FAST)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -kvo | --kv-offload )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable KV cache offloading (default: enabled)
(env: LLAMA_ARG_KV_OFFLOAD)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repack )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable weight repacking (default: enabled)
(env: LLAMA_ARG_REPACK)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --no-host )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
bypass host buffer allowing extra buffers to be used
(env: LLAMA_ARG_NO_HOST)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ctk | --cache-type-k )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ctv | --cache-type-v )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -dt | --defrag-thold )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
KV cache defragmentation threshold (DEPRECATED)
(env: LLAMA_ARG_DEFRAG_THOLD)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -np | --parallel )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of parallel sequences to decode (default: 1)
(env: LLAMA_ARG_N_PARALLEL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rpc )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
comma-separated list of RPC servers (host:port)
(env: LLAMA_ARG_RPC)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -lm | --load-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
model loading mode (default: auto)
- 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)"
            fi
            COMPREPLY=( $(compgen -W 'auto none mmap mlock mmap+mlock dio' -- "$cur") )
            return 0
        ;;
        -lzm | --lazy-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
on-demand reading of certain tensors, for example per-layer embeddings (default: auto)
- on: read the rows of such tensors from disk on demand instead of keeping them resident (requires mmap)
- auto: on, but only for tensors larger than 4 GiB
- off: always keep them resident
(env: LLAMA_ARG_LAZY_MODE)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        --numa )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
attempt optimizations that help on some NUMA systems
- 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)"
            fi
            COMPREPLY=( $(compgen -W 'distribute isolate numactl' -- "$cur") )
            return 0
        ;;
        -dev | --device )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --list-devices )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print list of available devices and exit"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ot | --override-tensor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
override tensor buffer type
(env: LLAMA_ARG_OVERRIDE_TENSOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -cmoe | --cpu-moe )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep all Mixture of Experts (MoE) weights in the CPU
(env: LLAMA_ARG_CPU_MOE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ncmoe | --n-cpu-moe )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep the Mixture of Experts (MoE) weights of the first N layers in the CPU
(env: LLAMA_ARG_N_CPU_MOE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --moe-cache-mib )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
GPU cache size in MiB for the MoE experts kept in the CPU. with multiple GPUs, it is split among them like the layers (--tensor-split) (default: 0, disabled)
(env: LLAMA_ARG_MOE_CACHE_MIB)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ncffn | --n-cpu-ffn )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep the dense FFN weights of the first N layers in the CPU
(dense models; for MoE expert weights use --n-cpu-moe)
(env: LLAMA_ARG_N_CPU_FFN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ngl | --gpu-layers | --n-gpu-layers )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
max. number of layers to store in VRAM, either an exact number, 'auto', or 'all' (default: auto)
(env: LLAMA_ARG_N_GPU_LAYERS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -sm | --split-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
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)"
            fi
            COMPREPLY=( $(compgen -W 'none layer row split' -- "$cur") )
            return 0
        ;;
        -ts | --tensor-split )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
fraction of the model to offload to each GPU, comma-separated list of proportions, e.g. 3,1
(env: LLAMA_ARG_TENSOR_SPLIT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -mg | --main-gpu )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fit | --fit )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
whether to adjust unset arguments to fit in device memory ('on' or 'off', default: 'on')
(env: LLAMA_ARG_FIT)"
            fi
            COMPREPLY=( $(compgen -W 'on off' -- "$cur") )
            return 0
        ;;
        -fitt | --fit-target )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fitc | --fit-ctx )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
minimum ctx size that can be set by --fit option, default: 4096
(env: LLAMA_ARG_FIT_CTX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --check-tensors )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
check model tensor data for invalid values (default: false)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --override-kv )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --op-offload )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to offload host tensor operations to device (default: true)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --lora )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to LoRA adapter (use comma-separated values to load multiple adapters)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --lora-scaled )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to LoRA adapter with user defined scaling (format: FNAME:SCALE,...)
note: use comma-separated values"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add a control vector
note: use comma-separated values to add multiple control vectors"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector-scaled )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add a control vector with user defined scaling SCALE
note: use comma-separated values (format: FNAME:SCALE,...)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector-layer-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
layer range to apply the control vector(s) to, start and end inclusive"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -m | --model )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
model path to load
(env: LLAMA_ARG_MODEL)"
            fi
            COMPREPLY=( $(compgen -f -X '!*.gguf' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -mu | --model-url )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
model download url (default: unused)
(env: LLAMA_ARG_MODEL_URL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -dr | --docker-repo )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Docker Hub model repository. repo is optional, default to ai/. quant is optional, default to :latest.
example: gemma3
(default: unused)
(env: LLAMA_ARG_DOCKER_REPO)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hf | -hfr | --hf-repo )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face model repository; quant is optional, case-insensitive, default to Q4_K_M, or falls back to the first file in the repo if Q4_K_M doesn't exist.
mmproj is also downloaded automatically if available. to disable, add --no-mmproj
example: ggml-org/GLM-4.7-Flash-GGUF:Q4_K_M
(default: unused)
(env: LLAMA_ARG_HF_REPO)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hff | --hf-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face model file. If specified, it will override the quant in --hf-repo (default: unused)
(env: LLAMA_ARG_HF_FILE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hft | --hf-token )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face access token (default: value from HF_TOKEN environment variable)
(env: HF_TOKEN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-disable )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log disable"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log to file
(env: LLAMA_ARG_LOG_FILE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-jsonl )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log as JSONL (one JSON object per line) to stdout, this also disables colored logging (default: disabled)
(env: LLAMA_ARG_LOG_JSONL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-colors )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
Set colored logging ('on', 'off', or 'auto', default: 'auto')
'auto' enables colors when output is to a terminal
(env: LLAMA_ARG_LOG_COLORS)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        -v | --verbose | --log-verbose )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Set verbosity level to infinity (i.e. log all messages, useful for debugging)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --offline )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Offline mode: forces use of cache, prevents network access
(env: LLAMA_ARG_OFFLINE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -lv | --verbosity | --log-verbosity )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Set the verbosity threshold. Messages with a higher verbosity will be ignored. Values:
 - 0: generic output
 - 1: error
 - 2: warning
 - 3: info
 - 4: trace (more info)
 - 5: debug
(default: 3)

(env: LLAMA_ARG_LOG_VERBOSITY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-prefix )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Enable prefix in log messages
(env: LLAMA_ARG_LOG_PREFIX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-timestamps )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Enable timestamps in log messages
(env: LLAMA_ARG_LOG_TIMESTAMPS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-type-k | -ctkd | --cache-type-k-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-type-v | -ctvd | --cache-type-v-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
KV cache data type for V 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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
    esac

case "$curr" in
    -* )
        COMPREPLY=( $(compgen -W "${opts}" -- "$curr") )
        return 0
    ;;
esac
} && complete -F _comp_cmd_llama_eval_callback llama-eval-callback

_comp_cmd_llama_finetune()
{
    local curr prev opts
    COMPREPLY=()
    curr="${COMP_WORDS[COMP_CWORD]}"
    prev="${COMP_WORDS[COMP_CWORD-1]}"

    opts="
        -h --help --usage
        --version
        -cl --cache-list
        --completion-bash
        -t --threads
        -tb --threads-batch
        -C --cpu-mask
        -Cr --cpu-range
        --cpu-strict
        --prio
        --poll
        -Cb --cpu-mask-batch
        -Crb --cpu-range-batch
        --cpu-strict-batch
        --prio-batch
        --poll-batch
        -c --ctx-size
        -n --predict --n-predict
        -b --batch-size
        -ub --ubatch-size
        --keep
        --swa-full
        -fa --flash-attn
        -p --prompt
        --perf
        -f --file
        -bf --binary-file
        -e --escape
        --rope-scaling
        --rope-scale
        --rope-freq-base
        --rope-freq-scale
        --yarn-orig-ctx
        --yarn-ext-factor
        --yarn-attn-factor
        --yarn-beta-slow
        --yarn-beta-fast
        -kvo --kv-offload
        --repack
        --no-host
        -ctk --cache-type-k
        -ctv --cache-type-v
        -dt --defrag-thold
        -np --parallel
        --rpc
        -lm --load-mode
        -lzm --lazy-mode
        --numa
        -dev --device
        --list-devices
        -ot --override-tensor
        -cmoe --cpu-moe
        -ncmoe --n-cpu-moe
        --moe-cache-mib
        -ncffn --n-cpu-ffn
        -ngl --gpu-layers --n-gpu-layers
        -sm --split-mode
        -ts --tensor-split
        -mg --main-gpu
        -fit --fit
        -fitt --fit-target
        -fitc --fit-ctx
        --check-tensors
        --override-kv
        --op-offload
        --lora
        --lora-scaled
        --control-vector
        --control-vector-scaled
        --control-vector-layer-range
        -m --model
        -mu --model-url
        -dr --docker-repo
        -hf -hfr --hf-repo
        -hff --hf-file
        -hft --hf-token
        --log-disable
        --log-file
        --log-jsonl
        --log-colors
        -v --verbose --log-verbose
        --offline
        -lv --verbosity --log-verbosity
        --log-prefix
        --log-timestamps
        --spec-draft-type-k -ctkd --cache-type-k-draft
        --spec-draft-type-v -ctvd --cache-type-v-draft
        --samplers
        -s --seed
        --sampler-seq --sampling-seq
        --ignore-eos
        --temp --temperature
        --top-k
        --top-p
        --min-p
        --top-nsigma --top-n-sigma
        --xtc-probability
        --xtc-threshold
        --typical --typical-p
        --repeat-last-n
        --repeat-penalty
        --presence-penalty
        --frequency-penalty
        --dry-multiplier
        --dry-base
        --dry-allowed-length
        --dry-penalty-last-n
        --dry-sequence-breaker
        --adaptive-target
        --adaptive-decay
        --dynatemp-range
        --dynatemp-exp
        --mirostat
        --mirostat-lr
        --mirostat-ent
        -l --logit-bias
        --grammar
        --grammar-file
        -j --json-schema
        -jf --json-schema-file
        -bs --backend-sampling
        -o --output --output-file
        -lr --learning-rate
        -lr-min --learning-rate-min
        -decay-epochs --learning-rate-decay-epochs
        -wd --weight-decay
        -val-split --val-split
        -epochs --epochs
        -opt --optimizer
    "

    case "$prev" in
        -h | --help | --usage )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print usage and exit"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --version )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
show version and build info"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -cl | --cache-list )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
show list of models in cache"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --completion-bash )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print source-able bash completion script for llama.cpp"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -t | --threads )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of CPU threads to use during generation (default: -1)
(env: LLAMA_ARG_THREADS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -tb | --threads-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of threads to use during batch and prompt processing (default: same as --threads)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -C | --cpu-mask )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
CPU affinity mask: arbitrarily long hex. Complements cpu-range (default: \"\")"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Cr | --cpu-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
range of CPUs for affinity. Complements --cpu-mask"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --cpu-strict )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use strict CPU placement (default: 0)
"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --prio )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set process/thread priority : low(-1), normal(0), medium(1), high(2), realtime(3) (default: 0)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --poll )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use polling level to wait for work (0 - no polling, default: 50)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Cb | --cpu-mask-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
CPU affinity mask: arbitrarily long hex. Complements cpu-range-batch (default: same as --cpu-mask)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Crb | --cpu-range-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ranges of CPUs for affinity. Complements --cpu-mask-batch"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --cpu-strict-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use strict CPU placement (default: same as --cpu-strict)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --prio-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set process/thread priority : 0-normal, 1-medium, 2-high, 3-realtime (default: 0)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --poll-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use polling to wait for work (default: same as --poll)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        -c | --ctx-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
size of the prompt context (default: 0, 0 = loaded from model)
(env: LLAMA_ARG_CTX_SIZE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -n | --predict | --n-predict )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of tokens to predict (default: -1, -1 = infinity)
(env: LLAMA_ARG_N_PREDICT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -b | --batch-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
logical maximum batch size (default: 2048)
(env: LLAMA_ARG_BATCH)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ub | --ubatch-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
physical maximum batch size (default: 512)
(env: LLAMA_ARG_UBATCH)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --keep )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of tokens to keep from the initial prompt (default: 0, -1 = all)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --swa-full )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fa | --flash-attn )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
set Flash Attention use ('on', 'off', or 'auto', default: 'auto')
(env: LLAMA_ARG_FLASH_ATTN)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        -p | --prompt )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
prompt to start generation with; for system message, use -sys"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --perf )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable internal libllama performance timings (default: false)
(env: LLAMA_ARG_PERF)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -f | --file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
a file containing the prompt (default: none)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -bf | --binary-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
binary file containing the prompt (default: none)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -e | --escape )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to process escapes sequences (\\n, \\r, \\t, \\', \\\", \\\\) (default: false)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-scaling )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
RoPE frequency scaling method, defaults to linear unless specified by the model
(env: LLAMA_ARG_ROPE_SCALING_TYPE)"
            fi
            COMPREPLY=( $(compgen -W 'none linear yarn' -- "$cur") )
            return 0
        ;;
        --rope-scale )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE context scaling factor, expands context by a factor of N
(env: LLAMA_ARG_ROPE_SCALE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-freq-base )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE base frequency, used by NTK-aware scaling (default: loaded from model)
(env: LLAMA_ARG_ROPE_FREQ_BASE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-freq-scale )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE frequency scaling factor, expands context by a factor of 1/N
(env: LLAMA_ARG_ROPE_FREQ_SCALE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-orig-ctx )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: original context size of model (default: 0 = model training context size)
(env: LLAMA_ARG_YARN_ORIG_CTX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-ext-factor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: extrapolation mix factor (default: -1.00, 0.0 = full interpolation)
(env: LLAMA_ARG_YARN_EXT_FACTOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-attn-factor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: scale sqrt(t) or attention magnitude (default: -1.00)
(env: LLAMA_ARG_YARN_ATTN_FACTOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-beta-slow )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: high correction dim or alpha (default: -1.00)
(env: LLAMA_ARG_YARN_BETA_SLOW)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-beta-fast )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: low correction dim or beta (default: -1.00)
(env: LLAMA_ARG_YARN_BETA_FAST)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -kvo | --kv-offload )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable KV cache offloading (default: enabled)
(env: LLAMA_ARG_KV_OFFLOAD)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repack )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable weight repacking (default: enabled)
(env: LLAMA_ARG_REPACK)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --no-host )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
bypass host buffer allowing extra buffers to be used
(env: LLAMA_ARG_NO_HOST)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ctk | --cache-type-k )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ctv | --cache-type-v )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -dt | --defrag-thold )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
KV cache defragmentation threshold (DEPRECATED)
(env: LLAMA_ARG_DEFRAG_THOLD)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -np | --parallel )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of parallel sequences to decode (default: 1)
(env: LLAMA_ARG_N_PARALLEL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rpc )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
comma-separated list of RPC servers (host:port)
(env: LLAMA_ARG_RPC)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -lm | --load-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
model loading mode (default: auto)
- 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)"
            fi
            COMPREPLY=( $(compgen -W 'auto none mmap mlock mmap+mlock dio' -- "$cur") )
            return 0
        ;;
        -lzm | --lazy-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
on-demand reading of certain tensors, for example per-layer embeddings (default: auto)
- on: read the rows of such tensors from disk on demand instead of keeping them resident (requires mmap)
- auto: on, but only for tensors larger than 4 GiB
- off: always keep them resident
(env: LLAMA_ARG_LAZY_MODE)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        --numa )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
attempt optimizations that help on some NUMA systems
- 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)"
            fi
            COMPREPLY=( $(compgen -W 'distribute isolate numactl' -- "$cur") )
            return 0
        ;;
        -dev | --device )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --list-devices )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print list of available devices and exit"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ot | --override-tensor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
override tensor buffer type
(env: LLAMA_ARG_OVERRIDE_TENSOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -cmoe | --cpu-moe )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep all Mixture of Experts (MoE) weights in the CPU
(env: LLAMA_ARG_CPU_MOE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ncmoe | --n-cpu-moe )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep the Mixture of Experts (MoE) weights of the first N layers in the CPU
(env: LLAMA_ARG_N_CPU_MOE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --moe-cache-mib )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
GPU cache size in MiB for the MoE experts kept in the CPU. with multiple GPUs, it is split among them like the layers (--tensor-split) (default: 0, disabled)
(env: LLAMA_ARG_MOE_CACHE_MIB)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ncffn | --n-cpu-ffn )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep the dense FFN weights of the first N layers in the CPU
(dense models; for MoE expert weights use --n-cpu-moe)
(env: LLAMA_ARG_N_CPU_FFN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ngl | --gpu-layers | --n-gpu-layers )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
max. number of layers to store in VRAM, either an exact number, 'auto', or 'all' (default: auto)
(env: LLAMA_ARG_N_GPU_LAYERS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -sm | --split-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
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)"
            fi
            COMPREPLY=( $(compgen -W 'none layer row split' -- "$cur") )
            return 0
        ;;
        -ts | --tensor-split )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
fraction of the model to offload to each GPU, comma-separated list of proportions, e.g. 3,1
(env: LLAMA_ARG_TENSOR_SPLIT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -mg | --main-gpu )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fit | --fit )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
whether to adjust unset arguments to fit in device memory ('on' or 'off', default: 'on')
(env: LLAMA_ARG_FIT)"
            fi
            COMPREPLY=( $(compgen -W 'on off' -- "$cur") )
            return 0
        ;;
        -fitt | --fit-target )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fitc | --fit-ctx )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
minimum ctx size that can be set by --fit option, default: 4096
(env: LLAMA_ARG_FIT_CTX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --check-tensors )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
check model tensor data for invalid values (default: false)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --override-kv )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --op-offload )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to offload host tensor operations to device (default: true)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --lora )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to LoRA adapter (use comma-separated values to load multiple adapters)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --lora-scaled )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to LoRA adapter with user defined scaling (format: FNAME:SCALE,...)
note: use comma-separated values"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add a control vector
note: use comma-separated values to add multiple control vectors"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector-scaled )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add a control vector with user defined scaling SCALE
note: use comma-separated values (format: FNAME:SCALE,...)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector-layer-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
layer range to apply the control vector(s) to, start and end inclusive"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -m | --model )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
model path to load
(env: LLAMA_ARG_MODEL)"
            fi
            COMPREPLY=( $(compgen -f -X '!*.gguf' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -mu | --model-url )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
model download url (default: unused)
(env: LLAMA_ARG_MODEL_URL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -dr | --docker-repo )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Docker Hub model repository. repo is optional, default to ai/. quant is optional, default to :latest.
example: gemma3
(default: unused)
(env: LLAMA_ARG_DOCKER_REPO)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hf | -hfr | --hf-repo )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face model repository; quant is optional, case-insensitive, default to Q4_K_M, or falls back to the first file in the repo if Q4_K_M doesn't exist.
mmproj is also downloaded automatically if available. to disable, add --no-mmproj
example: ggml-org/GLM-4.7-Flash-GGUF:Q4_K_M
(default: unused)
(env: LLAMA_ARG_HF_REPO)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hff | --hf-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face model file. If specified, it will override the quant in --hf-repo (default: unused)
(env: LLAMA_ARG_HF_FILE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hft | --hf-token )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face access token (default: value from HF_TOKEN environment variable)
(env: HF_TOKEN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-disable )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log disable"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log to file
(env: LLAMA_ARG_LOG_FILE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-jsonl )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log as JSONL (one JSON object per line) to stdout, this also disables colored logging (default: disabled)
(env: LLAMA_ARG_LOG_JSONL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-colors )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
Set colored logging ('on', 'off', or 'auto', default: 'auto')
'auto' enables colors when output is to a terminal
(env: LLAMA_ARG_LOG_COLORS)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        -v | --verbose | --log-verbose )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Set verbosity level to infinity (i.e. log all messages, useful for debugging)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --offline )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Offline mode: forces use of cache, prevents network access
(env: LLAMA_ARG_OFFLINE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -lv | --verbosity | --log-verbosity )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Set the verbosity threshold. Messages with a higher verbosity will be ignored. Values:
 - 0: generic output
 - 1: error
 - 2: warning
 - 3: info
 - 4: trace (more info)
 - 5: debug
(default: 3)

(env: LLAMA_ARG_LOG_VERBOSITY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-prefix )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Enable prefix in log messages
(env: LLAMA_ARG_LOG_PREFIX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-timestamps )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Enable timestamps in log messages
(env: LLAMA_ARG_LOG_TIMESTAMPS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-type-k | -ctkd | --cache-type-k-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-type-v | -ctvd | --cache-type-v-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
KV cache data type for V 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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --samplers )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
samplers that will be used for generation in the order, separated by ';'
(default: penalties;dry;top_n_sigma;top_k;typ_p;top_p;min_p;xtc;temperature)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -s | --seed )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RNG seed (default: -1, use random seed for -1)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --sampler-seq | --sampling-seq )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
simplified sequence for samplers that will be used (default: edskypmxt)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --ignore-eos )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ignore end of stream token and continue generating (implies --logit-bias EOS-inf)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --temp | --temperature )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
temperature (default: 0.80)
(env: LLAMA_ARG_TEMPERATURE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-k )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-k sampling (default: 40, 0 = disabled)
(env: LLAMA_ARG_TOP_K)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-p sampling (default: 0.95, 1.0 = disabled)
(env: LLAMA_ARG_TOP_P)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --min-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
min-p sampling (default: 0.05, 0.0 = disabled)
(env: LLAMA_ARG_MIN_P)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-nsigma | --top-n-sigma )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-n-sigma sampling (default: -1.00, -1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --xtc-probability )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
xtc probability (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --xtc-threshold )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
xtc threshold (default: 0.10, 1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --typical | --typical-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
locally typical sampling, parameter p (default: 1.00, 1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repeat-last-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
last n tokens to consider for penalize (default: 64, 0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repeat-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
penalize repeat sequence of tokens (default: 1.00, 1.0 = disabled)
(env: LLAMA_ARG_REPEAT_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --presence-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
repeat alpha presence penalty (default: 0.00, 0.0 = disabled)
(env: LLAMA_ARG_PRESENCE_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --frequency-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
repeat alpha frequency penalty (default: 0.00, 0.0 = disabled)
(env: LLAMA_ARG_FREQUENCY_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-multiplier )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY sampling multiplier (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-base )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY sampling base value (default: 1.75)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-allowed-length )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set allowed length for DRY sampling (default: 2)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-penalty-last-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY penalty for the last n tokens (default: 64, 0 = disable)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-sequence-breaker )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add sequence breaker for DRY sampling, clearing out default breakers ('\\n', ':', '\"', '*') in the process; use \"none\" to not use any sequence breakers
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --adaptive-target )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
adaptive-p: select tokens near this probability (valid range 0.0 to 1.0; negative = disabled) (default: -1.00)
[(more info)](https://github.com/ggml-org/llama.cpp/pull/17927)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --adaptive-decay )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
adaptive-p: 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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dynatemp-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
dynamic temperature range (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dynatemp-exp )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
dynamic temperature exponent (default: 1.00)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use Mirostat sampling.
Top K, Nucleus and Locally Typical samplers are ignored if used.
(default: 0, 0 = disabled, 1 = Mirostat, 2 = Mirostat 2.0)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat-lr )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Mirostat learning rate, parameter eta (default: 0.10)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat-ent )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Mirostat target entropy, parameter tau (default: 5.00)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -l | --logit-bias )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
modifies the likelihood of token appearing in the completion,
i.e. \`--logit-bias 15043+1\` to increase likelihood of token ' Hello',
or \`--logit-bias 15043-1\` to decrease likelihood of token ' Hello'"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --grammar )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
BNF-like grammar to constrain generations (see samples in grammars/ dir)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --grammar-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
file to read grammar from"
            fi
            COMPREPLY=( $(compgen -f -X '!*.gbnf' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -j | --json-schema )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
JSON schema to constrain generations (https://json-schema.org/), e.g. \`{\"type\": \"object\"}\` for any JSON object"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -jf | --json-schema-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
File containing a JSON schema to constrain generations (https://json-schema.org/), e.g. \`{\"type\": \"object\"}\` for any JSON object"
            fi
            COMPREPLY=( $(compgen -f -X '!*.json' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -bs | --backend-sampling )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
enable backend sampling (experimental) (default: disabled)
(env: LLAMA_ARG_BACKEND_SAMPLING)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -o | --output | --output-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
output file (default: '')"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -lr | --learning-rate )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
adamw or sgd optimizer alpha (default: 1e-05); note: sgd alpha recommended ~10x (no momentum)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -lr-min | --learning-rate-min )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
(if >0) final learning rate after decay (if -decay-epochs is set, default=-1)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -decay-epochs | --learning-rate-decay-epochs )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
(if >0) decay learning rate to -lr-min after this many epochs (exponential decay, default=-1)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -wd | --weight-decay )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
adamw or sgd optimizer weight decay (0 is off; recommend very small e.g. 1e-9) (default: 0)."
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -val-split | --val-split )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
fraction of data to use as validation set for training (default: 0.05)."
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -epochs | --epochs )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
optimizer max # of epochs (default: 2)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -opt | --optimizer )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
adamw or sgd"
            fi
            COMPREPLY=( $(compgen -W 'adamw sgd' -- "$cur") )
            return 0
        ;;
    esac

case "$curr" in
    -* )
        COMPREPLY=( $(compgen -W "${opts}" -- "$curr") )
        return 0
    ;;
esac
} && complete -F _comp_cmd_llama_finetune llama-finetune

_comp_cmd_llama_fit_params()
{
    local curr prev opts
    COMPREPLY=()
    curr="${COMP_WORDS[COMP_CWORD]}"
    prev="${COMP_WORDS[COMP_CWORD-1]}"

    opts="
        -h --help --usage
        --version
        -cl --cache-list
        --completion-bash
        -t --threads
        -tb --threads-batch
        -C --cpu-mask
        -Cr --cpu-range
        --cpu-strict
        --prio
        --poll
        -Cb --cpu-mask-batch
        -Crb --cpu-range-batch
        --cpu-strict-batch
        --prio-batch
        --poll-batch
        -c --ctx-size
        -n --predict --n-predict
        -b --batch-size
        -ub --ubatch-size
        --keep
        --swa-full
        -fa --flash-attn
        -p --prompt
        --perf
        -f --file
        -bf --binary-file
        -e --escape
        --rope-scaling
        --rope-scale
        --rope-freq-base
        --rope-freq-scale
        --yarn-orig-ctx
        --yarn-ext-factor
        --yarn-attn-factor
        --yarn-beta-slow
        --yarn-beta-fast
        -kvo --kv-offload
        --repack
        --no-host
        -ctk --cache-type-k
        -ctv --cache-type-v
        -dt --defrag-thold
        -np --parallel
        --rpc
        -lm --load-mode
        -lzm --lazy-mode
        --numa
        -dev --device
        --list-devices
        -ot --override-tensor
        -cmoe --cpu-moe
        -ncmoe --n-cpu-moe
        --moe-cache-mib
        -ncffn --n-cpu-ffn
        -ngl --gpu-layers --n-gpu-layers
        -sm --split-mode
        -ts --tensor-split
        -mg --main-gpu
        -fit --fit
        -fitt --fit-target
        -fitc --fit-ctx
        --check-tensors
        --override-kv
        --op-offload
        --lora
        --lora-scaled
        --control-vector
        --control-vector-scaled
        --control-vector-layer-range
        -m --model
        -mu --model-url
        -dr --docker-repo
        -hf -hfr --hf-repo
        -hff --hf-file
        -hft --hf-token
        --log-disable
        --log-file
        --log-jsonl
        --log-colors
        -v --verbose --log-verbose
        --offline
        -lv --verbosity --log-verbosity
        --log-prefix
        --log-timestamps
        --spec-draft-type-k -ctkd --cache-type-k-draft
        --spec-draft-type-v -ctvd --cache-type-v-draft
        --samplers
        -s --seed
        --sampler-seq --sampling-seq
        --ignore-eos
        --temp --temperature
        --top-k
        --top-p
        --min-p
        --top-nsigma --top-n-sigma
        --xtc-probability
        --xtc-threshold
        --typical --typical-p
        --repeat-last-n
        --repeat-penalty
        --presence-penalty
        --frequency-penalty
        --dry-multiplier
        --dry-base
        --dry-allowed-length
        --dry-penalty-last-n
        --dry-sequence-breaker
        --adaptive-target
        --adaptive-decay
        --dynatemp-range
        --dynatemp-exp
        --mirostat
        --mirostat-lr
        --mirostat-ent
        -l --logit-bias
        --grammar
        --grammar-file
        -j --json-schema
        -jf --json-schema-file
        -bs --backend-sampling
        -fitp --fit-print
    "

    case "$prev" in
        -h | --help | --usage )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print usage and exit"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --version )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
show version and build info"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -cl | --cache-list )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
show list of models in cache"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --completion-bash )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print source-able bash completion script for llama.cpp"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -t | --threads )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of CPU threads to use during generation (default: -1)
(env: LLAMA_ARG_THREADS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -tb | --threads-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of threads to use during batch and prompt processing (default: same as --threads)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -C | --cpu-mask )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
CPU affinity mask: arbitrarily long hex. Complements cpu-range (default: \"\")"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Cr | --cpu-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
range of CPUs for affinity. Complements --cpu-mask"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --cpu-strict )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use strict CPU placement (default: 0)
"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --prio )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set process/thread priority : low(-1), normal(0), medium(1), high(2), realtime(3) (default: 0)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --poll )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use polling level to wait for work (0 - no polling, default: 50)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Cb | --cpu-mask-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
CPU affinity mask: arbitrarily long hex. Complements cpu-range-batch (default: same as --cpu-mask)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Crb | --cpu-range-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ranges of CPUs for affinity. Complements --cpu-mask-batch"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --cpu-strict-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use strict CPU placement (default: same as --cpu-strict)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --prio-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set process/thread priority : 0-normal, 1-medium, 2-high, 3-realtime (default: 0)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --poll-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use polling to wait for work (default: same as --poll)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        -c | --ctx-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
size of the prompt context (default: 0, 0 = loaded from model)
(env: LLAMA_ARG_CTX_SIZE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -n | --predict | --n-predict )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of tokens to predict (default: -1, -1 = infinity)
(env: LLAMA_ARG_N_PREDICT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -b | --batch-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
logical maximum batch size (default: 2048)
(env: LLAMA_ARG_BATCH)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ub | --ubatch-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
physical maximum batch size (default: 512)
(env: LLAMA_ARG_UBATCH)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --keep )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of tokens to keep from the initial prompt (default: 0, -1 = all)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --swa-full )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fa | --flash-attn )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
set Flash Attention use ('on', 'off', or 'auto', default: 'auto')
(env: LLAMA_ARG_FLASH_ATTN)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        -p | --prompt )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
prompt to start generation with; for system message, use -sys"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --perf )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable internal libllama performance timings (default: false)
(env: LLAMA_ARG_PERF)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -f | --file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
a file containing the prompt (default: none)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -bf | --binary-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
binary file containing the prompt (default: none)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -e | --escape )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to process escapes sequences (\\n, \\r, \\t, \\', \\\", \\\\) (default: true)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-scaling )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
RoPE frequency scaling method, defaults to linear unless specified by the model
(env: LLAMA_ARG_ROPE_SCALING_TYPE)"
            fi
            COMPREPLY=( $(compgen -W 'none linear yarn' -- "$cur") )
            return 0
        ;;
        --rope-scale )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE context scaling factor, expands context by a factor of N
(env: LLAMA_ARG_ROPE_SCALE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-freq-base )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE base frequency, used by NTK-aware scaling (default: loaded from model)
(env: LLAMA_ARG_ROPE_FREQ_BASE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-freq-scale )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE frequency scaling factor, expands context by a factor of 1/N
(env: LLAMA_ARG_ROPE_FREQ_SCALE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-orig-ctx )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: original context size of model (default: 0 = model training context size)
(env: LLAMA_ARG_YARN_ORIG_CTX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-ext-factor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: extrapolation mix factor (default: -1.00, 0.0 = full interpolation)
(env: LLAMA_ARG_YARN_EXT_FACTOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-attn-factor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: scale sqrt(t) or attention magnitude (default: -1.00)
(env: LLAMA_ARG_YARN_ATTN_FACTOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-beta-slow )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: high correction dim or alpha (default: -1.00)
(env: LLAMA_ARG_YARN_BETA_SLOW)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-beta-fast )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: low correction dim or beta (default: -1.00)
(env: LLAMA_ARG_YARN_BETA_FAST)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -kvo | --kv-offload )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable KV cache offloading (default: enabled)
(env: LLAMA_ARG_KV_OFFLOAD)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repack )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable weight repacking (default: enabled)
(env: LLAMA_ARG_REPACK)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --no-host )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
bypass host buffer allowing extra buffers to be used
(env: LLAMA_ARG_NO_HOST)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ctk | --cache-type-k )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ctv | --cache-type-v )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -dt | --defrag-thold )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
KV cache defragmentation threshold (DEPRECATED)
(env: LLAMA_ARG_DEFRAG_THOLD)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -np | --parallel )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of parallel sequences to decode (default: 1)
(env: LLAMA_ARG_N_PARALLEL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rpc )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
comma-separated list of RPC servers (host:port)
(env: LLAMA_ARG_RPC)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -lm | --load-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
model loading mode (default: auto)
- 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)"
            fi
            COMPREPLY=( $(compgen -W 'auto none mmap mlock mmap+mlock dio' -- "$cur") )
            return 0
        ;;
        -lzm | --lazy-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
on-demand reading of certain tensors, for example per-layer embeddings (default: auto)
- on: read the rows of such tensors from disk on demand instead of keeping them resident (requires mmap)
- auto: on, but only for tensors larger than 4 GiB
- off: always keep them resident
(env: LLAMA_ARG_LAZY_MODE)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        --numa )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
attempt optimizations that help on some NUMA systems
- 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)"
            fi
            COMPREPLY=( $(compgen -W 'distribute isolate numactl' -- "$cur") )
            return 0
        ;;
        -dev | --device )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --list-devices )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print list of available devices and exit"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ot | --override-tensor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
override tensor buffer type
(env: LLAMA_ARG_OVERRIDE_TENSOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -cmoe | --cpu-moe )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep all Mixture of Experts (MoE) weights in the CPU
(env: LLAMA_ARG_CPU_MOE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ncmoe | --n-cpu-moe )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep the Mixture of Experts (MoE) weights of the first N layers in the CPU
(env: LLAMA_ARG_N_CPU_MOE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --moe-cache-mib )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
GPU cache size in MiB for the MoE experts kept in the CPU. with multiple GPUs, it is split among them like the layers (--tensor-split) (default: 0, disabled)
(env: LLAMA_ARG_MOE_CACHE_MIB)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ncffn | --n-cpu-ffn )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep the dense FFN weights of the first N layers in the CPU
(dense models; for MoE expert weights use --n-cpu-moe)
(env: LLAMA_ARG_N_CPU_FFN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ngl | --gpu-layers | --n-gpu-layers )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
max. number of layers to store in VRAM, either an exact number, 'auto', or 'all' (default: auto)
(env: LLAMA_ARG_N_GPU_LAYERS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -sm | --split-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
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)"
            fi
            COMPREPLY=( $(compgen -W 'none layer row split' -- "$cur") )
            return 0
        ;;
        -ts | --tensor-split )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
fraction of the model to offload to each GPU, comma-separated list of proportions, e.g. 3,1
(env: LLAMA_ARG_TENSOR_SPLIT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -mg | --main-gpu )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fit | --fit )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
whether to adjust unset arguments to fit in device memory ('on' or 'off', default: 'on')
(env: LLAMA_ARG_FIT)"
            fi
            COMPREPLY=( $(compgen -W 'on off' -- "$cur") )
            return 0
        ;;
        -fitt | --fit-target )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fitc | --fit-ctx )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
minimum ctx size that can be set by --fit option, default: 4096
(env: LLAMA_ARG_FIT_CTX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --check-tensors )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
check model tensor data for invalid values (default: false)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --override-kv )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --op-offload )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to offload host tensor operations to device (default: true)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --lora )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to LoRA adapter (use comma-separated values to load multiple adapters)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --lora-scaled )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to LoRA adapter with user defined scaling (format: FNAME:SCALE,...)
note: use comma-separated values"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add a control vector
note: use comma-separated values to add multiple control vectors"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector-scaled )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add a control vector with user defined scaling SCALE
note: use comma-separated values (format: FNAME:SCALE,...)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector-layer-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
layer range to apply the control vector(s) to, start and end inclusive"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -m | --model )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
model path to load
(env: LLAMA_ARG_MODEL)"
            fi
            COMPREPLY=( $(compgen -f -X '!*.gguf' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -mu | --model-url )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
model download url (default: unused)
(env: LLAMA_ARG_MODEL_URL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -dr | --docker-repo )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Docker Hub model repository. repo is optional, default to ai/. quant is optional, default to :latest.
example: gemma3
(default: unused)
(env: LLAMA_ARG_DOCKER_REPO)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hf | -hfr | --hf-repo )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face model repository; quant is optional, case-insensitive, default to Q4_K_M, or falls back to the first file in the repo if Q4_K_M doesn't exist.
mmproj is also downloaded automatically if available. to disable, add --no-mmproj
example: ggml-org/GLM-4.7-Flash-GGUF:Q4_K_M
(default: unused)
(env: LLAMA_ARG_HF_REPO)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hff | --hf-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face model file. If specified, it will override the quant in --hf-repo (default: unused)
(env: LLAMA_ARG_HF_FILE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hft | --hf-token )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face access token (default: value from HF_TOKEN environment variable)
(env: HF_TOKEN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-disable )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log disable"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log to file
(env: LLAMA_ARG_LOG_FILE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-jsonl )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log as JSONL (one JSON object per line) to stdout, this also disables colored logging (default: disabled)
(env: LLAMA_ARG_LOG_JSONL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-colors )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
Set colored logging ('on', 'off', or 'auto', default: 'auto')
'auto' enables colors when output is to a terminal
(env: LLAMA_ARG_LOG_COLORS)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        -v | --verbose | --log-verbose )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Set verbosity level to infinity (i.e. log all messages, useful for debugging)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --offline )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Offline mode: forces use of cache, prevents network access
(env: LLAMA_ARG_OFFLINE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -lv | --verbosity | --log-verbosity )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Set the verbosity threshold. Messages with a higher verbosity will be ignored. Values:
 - 0: generic output
 - 1: error
 - 2: warning
 - 3: info
 - 4: trace (more info)
 - 5: debug
(default: 3)

(env: LLAMA_ARG_LOG_VERBOSITY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-prefix )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Enable prefix in log messages
(env: LLAMA_ARG_LOG_PREFIX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-timestamps )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Enable timestamps in log messages
(env: LLAMA_ARG_LOG_TIMESTAMPS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-type-k | -ctkd | --cache-type-k-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-type-v | -ctvd | --cache-type-v-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
KV cache data type for V 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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --samplers )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
samplers that will be used for generation in the order, separated by ';'
(default: penalties;dry;top_n_sigma;top_k;typ_p;top_p;min_p;xtc;temperature)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -s | --seed )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RNG seed (default: -1, use random seed for -1)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --sampler-seq | --sampling-seq )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
simplified sequence for samplers that will be used (default: edskypmxt)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --ignore-eos )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ignore end of stream token and continue generating (implies --logit-bias EOS-inf)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --temp | --temperature )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
temperature (default: 0.80)
(env: LLAMA_ARG_TEMPERATURE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-k )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-k sampling (default: 40, 0 = disabled)
(env: LLAMA_ARG_TOP_K)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-p sampling (default: 0.95, 1.0 = disabled)
(env: LLAMA_ARG_TOP_P)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --min-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
min-p sampling (default: 0.05, 0.0 = disabled)
(env: LLAMA_ARG_MIN_P)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-nsigma | --top-n-sigma )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-n-sigma sampling (default: -1.00, -1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --xtc-probability )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
xtc probability (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --xtc-threshold )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
xtc threshold (default: 0.10, 1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --typical | --typical-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
locally typical sampling, parameter p (default: 1.00, 1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repeat-last-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
last n tokens to consider for penalize (default: 64, 0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repeat-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
penalize repeat sequence of tokens (default: 1.00, 1.0 = disabled)
(env: LLAMA_ARG_REPEAT_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --presence-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
repeat alpha presence penalty (default: 0.00, 0.0 = disabled)
(env: LLAMA_ARG_PRESENCE_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --frequency-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
repeat alpha frequency penalty (default: 0.00, 0.0 = disabled)
(env: LLAMA_ARG_FREQUENCY_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-multiplier )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY sampling multiplier (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-base )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY sampling base value (default: 1.75)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-allowed-length )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set allowed length for DRY sampling (default: 2)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-penalty-last-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY penalty for the last n tokens (default: 64, 0 = disable)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-sequence-breaker )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add sequence breaker for DRY sampling, clearing out default breakers ('\\n', ':', '\"', '*') in the process; use \"none\" to not use any sequence breakers
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --adaptive-target )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
adaptive-p: select tokens near this probability (valid range 0.0 to 1.0; negative = disabled) (default: -1.00)
[(more info)](https://github.com/ggml-org/llama.cpp/pull/17927)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --adaptive-decay )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
adaptive-p: 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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dynatemp-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
dynamic temperature range (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dynatemp-exp )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
dynamic temperature exponent (default: 1.00)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use Mirostat sampling.
Top K, Nucleus and Locally Typical samplers are ignored if used.
(default: 0, 0 = disabled, 1 = Mirostat, 2 = Mirostat 2.0)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat-lr )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Mirostat learning rate, parameter eta (default: 0.10)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat-ent )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Mirostat target entropy, parameter tau (default: 5.00)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -l | --logit-bias )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
modifies the likelihood of token appearing in the completion,
i.e. \`--logit-bias 15043+1\` to increase likelihood of token ' Hello',
or \`--logit-bias 15043-1\` to decrease likelihood of token ' Hello'"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --grammar )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
BNF-like grammar to constrain generations (see samples in grammars/ dir)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --grammar-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
file to read grammar from"
            fi
            COMPREPLY=( $(compgen -f -X '!*.gbnf' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -j | --json-schema )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
JSON schema to constrain generations (https://json-schema.org/), e.g. \`{\"type\": \"object\"}\` for any JSON object"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -jf | --json-schema-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
File containing a JSON schema to constrain generations (https://json-schema.org/), e.g. \`{\"type\": \"object\"}\` for any JSON object"
            fi
            COMPREPLY=( $(compgen -f -X '!*.json' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -bs | --backend-sampling )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
enable backend sampling (experimental) (default: disabled)
(env: LLAMA_ARG_BACKEND_SAMPLING)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fitp | --fit-print )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
print the estimated required memory ('on' or 'off', default: 'off')
(env: LLAMA_ARG_FIT_ESTIMATE)"
            fi
            COMPREPLY=( $(compgen -W 'on off' -- "$cur") )
            return 0
        ;;
    esac

case "$curr" in
    -* )
        COMPREPLY=( $(compgen -W "${opts}" -- "$curr") )
        return 0
    ;;
esac
} && complete -F _comp_cmd_llama_fit_params llama-fit-params

_comp_cmd_llama_idle()
{
    local curr prev opts
    COMPREPLY=()
    curr="${COMP_WORDS[COMP_CWORD]}"
    prev="${COMP_WORDS[COMP_CWORD-1]}"

    opts="
        --samplers
        -s --seed
        --sampler-seq --sampling-seq
        --ignore-eos
        --temp --temperature
        --top-k
        --top-p
        --min-p
        --top-nsigma --top-n-sigma
        --xtc-probability
        --xtc-threshold
        --typical --typical-p
        --repeat-last-n
        --repeat-penalty
        --presence-penalty
        --frequency-penalty
        --dry-multiplier
        --dry-base
        --dry-allowed-length
        --dry-penalty-last-n
        --dry-sequence-breaker
        --adaptive-target
        --adaptive-decay
        --dynatemp-range
        --dynatemp-exp
        --mirostat
        --mirostat-lr
        --mirostat-ent
        -l --logit-bias
        --grammar
        --grammar-file
        -j --json-schema
        -jf --json-schema-file
        -bs --backend-sampling
        -h --help --usage
        --version
        -cl --cache-list
        --completion-bash
        -t --threads
        -tb --threads-batch
        -C --cpu-mask
        -Cr --cpu-range
        --cpu-strict
        --prio
        --poll
        -Cb --cpu-mask-batch
        -Crb --cpu-range-batch
        --cpu-strict-batch
        --prio-batch
        --poll-batch
        -c --ctx-size
        -n --predict --n-predict
        -b --batch-size
        -ub --ubatch-size
        --keep
        --swa-full
        -fa --flash-attn
        -p --prompt
        --perf
        -f --file
        -bf --binary-file
        -e --escape
        --rope-scaling
        --rope-scale
        --rope-freq-base
        --rope-freq-scale
        --yarn-orig-ctx
        --yarn-ext-factor
        --yarn-attn-factor
        --yarn-beta-slow
        --yarn-beta-fast
        -kvo --kv-offload
        --repack
        --no-host
        -ctk --cache-type-k
        -ctv --cache-type-v
        -dt --defrag-thold
        -np --parallel
        --rpc
        -lm --load-mode
        -lzm --lazy-mode
        --numa
        -dev --device
        --list-devices
        -ot --override-tensor
        -cmoe --cpu-moe
        -ncmoe --n-cpu-moe
        --moe-cache-mib
        -ncffn --n-cpu-ffn
        -ngl --gpu-layers --n-gpu-layers
        -sm --split-mode
        -ts --tensor-split
        -mg --main-gpu
        -fit --fit
        -fitt --fit-target
        -fitc --fit-ctx
        --check-tensors
        --override-kv
        --op-offload
        --lora
        --lora-scaled
        --control-vector
        --control-vector-scaled
        --control-vector-layer-range
        -m --model
        -mu --model-url
        -dr --docker-repo
        -hf -hfr --hf-repo
        -hff --hf-file
        -hft --hf-token
        --log-disable
        --log-file
        --log-jsonl
        --log-colors
        -v --verbose --log-verbose
        --offline
        -lv --verbosity --log-verbosity
        --log-prefix
        --log-timestamps
        --spec-draft-type-k -ctkd --cache-type-k-draft
        --spec-draft-type-v -ctvd --cache-type-v-draft
    "

    case "$prev" in
        --samplers )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
samplers that will be used for generation in the order, separated by ';'
(default: penalties;dry;top_n_sigma;top_k;typ_p;top_p;min_p;xtc;temperature)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -s | --seed )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RNG seed (default: -1, use random seed for -1)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --sampler-seq | --sampling-seq )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
simplified sequence for samplers that will be used (default: edskypmxt)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --ignore-eos )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ignore end of stream token and continue generating (implies --logit-bias EOS-inf)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --temp | --temperature )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
temperature (default: 0.80)
(env: LLAMA_ARG_TEMPERATURE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-k )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-k sampling (default: 40, 0 = disabled)
(env: LLAMA_ARG_TOP_K)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-p sampling (default: 0.95, 1.0 = disabled)
(env: LLAMA_ARG_TOP_P)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --min-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
min-p sampling (default: 0.05, 0.0 = disabled)
(env: LLAMA_ARG_MIN_P)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-nsigma | --top-n-sigma )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-n-sigma sampling (default: -1.00, -1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --xtc-probability )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
xtc probability (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --xtc-threshold )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
xtc threshold (default: 0.10, 1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --typical | --typical-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
locally typical sampling, parameter p (default: 1.00, 1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repeat-last-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
last n tokens to consider for penalize (default: 64, 0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repeat-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
penalize repeat sequence of tokens (default: 1.00, 1.0 = disabled)
(env: LLAMA_ARG_REPEAT_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --presence-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
repeat alpha presence penalty (default: 0.00, 0.0 = disabled)
(env: LLAMA_ARG_PRESENCE_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --frequency-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
repeat alpha frequency penalty (default: 0.00, 0.0 = disabled)
(env: LLAMA_ARG_FREQUENCY_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-multiplier )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY sampling multiplier (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-base )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY sampling base value (default: 1.75)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-allowed-length )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set allowed length for DRY sampling (default: 2)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-penalty-last-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY penalty for the last n tokens (default: 64, 0 = disable)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-sequence-breaker )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add sequence breaker for DRY sampling, clearing out default breakers ('\\n', ':', '\"', '*') in the process; use \"none\" to not use any sequence breakers
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --adaptive-target )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
adaptive-p: select tokens near this probability (valid range 0.0 to 1.0; negative = disabled) (default: -1.00)
[(more info)](https://github.com/ggml-org/llama.cpp/pull/17927)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --adaptive-decay )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
adaptive-p: 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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dynatemp-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
dynamic temperature range (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dynatemp-exp )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
dynamic temperature exponent (default: 1.00)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use Mirostat sampling.
Top K, Nucleus and Locally Typical samplers are ignored if used.
(default: 0, 0 = disabled, 1 = Mirostat, 2 = Mirostat 2.0)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat-lr )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Mirostat learning rate, parameter eta (default: 0.10)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat-ent )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Mirostat target entropy, parameter tau (default: 5.00)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -l | --logit-bias )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
modifies the likelihood of token appearing in the completion,
i.e. \`--logit-bias 15043+1\` to increase likelihood of token ' Hello',
or \`--logit-bias 15043-1\` to decrease likelihood of token ' Hello'"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --grammar )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
BNF-like grammar to constrain generations (see samples in grammars/ dir)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --grammar-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
file to read grammar from"
            fi
            COMPREPLY=( $(compgen -f -X '!*.gbnf' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -j | --json-schema )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
JSON schema to constrain generations (https://json-schema.org/), e.g. \`{\"type\": \"object\"}\` for any JSON object"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -jf | --json-schema-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
File containing a JSON schema to constrain generations (https://json-schema.org/), e.g. \`{\"type\": \"object\"}\` for any JSON object"
            fi
            COMPREPLY=( $(compgen -f -X '!*.json' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -bs | --backend-sampling )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
enable backend sampling (experimental) (default: disabled)
(env: LLAMA_ARG_BACKEND_SAMPLING)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -h | --help | --usage )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print usage and exit"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --version )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
show version and build info"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -cl | --cache-list )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
show list of models in cache"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --completion-bash )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print source-able bash completion script for llama.cpp"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -t | --threads )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of CPU threads to use during generation (default: -1)
(env: LLAMA_ARG_THREADS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -tb | --threads-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of threads to use during batch and prompt processing (default: same as --threads)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -C | --cpu-mask )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
CPU affinity mask: arbitrarily long hex. Complements cpu-range (default: \"\")"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Cr | --cpu-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
range of CPUs for affinity. Complements --cpu-mask"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --cpu-strict )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use strict CPU placement (default: 0)
"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --prio )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set process/thread priority : low(-1), normal(0), medium(1), high(2), realtime(3) (default: 0)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --poll )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use polling level to wait for work (0 - no polling, default: 50)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Cb | --cpu-mask-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
CPU affinity mask: arbitrarily long hex. Complements cpu-range-batch (default: same as --cpu-mask)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Crb | --cpu-range-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ranges of CPUs for affinity. Complements --cpu-mask-batch"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --cpu-strict-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use strict CPU placement (default: same as --cpu-strict)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --prio-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set process/thread priority : 0-normal, 1-medium, 2-high, 3-realtime (default: 0)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --poll-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use polling to wait for work (default: same as --poll)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        -c | --ctx-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
size of the prompt context (default: 0, 0 = loaded from model)
(env: LLAMA_ARG_CTX_SIZE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -n | --predict | --n-predict )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of tokens to predict (default: -1, -1 = infinity)
(env: LLAMA_ARG_N_PREDICT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -b | --batch-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
logical maximum batch size (default: 2048)
(env: LLAMA_ARG_BATCH)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ub | --ubatch-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
physical maximum batch size (default: 512)
(env: LLAMA_ARG_UBATCH)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --keep )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of tokens to keep from the initial prompt (default: 0, -1 = all)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --swa-full )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fa | --flash-attn )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
set Flash Attention use ('on', 'off', or 'auto', default: 'auto')
(env: LLAMA_ARG_FLASH_ATTN)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        -p | --prompt )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
prompt to start generation with; for system message, use -sys"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --perf )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable internal libllama performance timings (default: false)
(env: LLAMA_ARG_PERF)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -f | --file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
a file containing the prompt (default: none)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -bf | --binary-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
binary file containing the prompt (default: none)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -e | --escape )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to process escapes sequences (\\n, \\r, \\t, \\', \\\", \\\\) (default: true)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-scaling )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
RoPE frequency scaling method, defaults to linear unless specified by the model
(env: LLAMA_ARG_ROPE_SCALING_TYPE)"
            fi
            COMPREPLY=( $(compgen -W 'none linear yarn' -- "$cur") )
            return 0
        ;;
        --rope-scale )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE context scaling factor, expands context by a factor of N
(env: LLAMA_ARG_ROPE_SCALE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-freq-base )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE base frequency, used by NTK-aware scaling (default: loaded from model)
(env: LLAMA_ARG_ROPE_FREQ_BASE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-freq-scale )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE frequency scaling factor, expands context by a factor of 1/N
(env: LLAMA_ARG_ROPE_FREQ_SCALE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-orig-ctx )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: original context size of model (default: 0 = model training context size)
(env: LLAMA_ARG_YARN_ORIG_CTX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-ext-factor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: extrapolation mix factor (default: -1.00, 0.0 = full interpolation)
(env: LLAMA_ARG_YARN_EXT_FACTOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-attn-factor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: scale sqrt(t) or attention magnitude (default: -1.00)
(env: LLAMA_ARG_YARN_ATTN_FACTOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-beta-slow )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: high correction dim or alpha (default: -1.00)
(env: LLAMA_ARG_YARN_BETA_SLOW)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-beta-fast )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: low correction dim or beta (default: -1.00)
(env: LLAMA_ARG_YARN_BETA_FAST)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -kvo | --kv-offload )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable KV cache offloading (default: enabled)
(env: LLAMA_ARG_KV_OFFLOAD)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repack )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable weight repacking (default: enabled)
(env: LLAMA_ARG_REPACK)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --no-host )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
bypass host buffer allowing extra buffers to be used
(env: LLAMA_ARG_NO_HOST)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ctk | --cache-type-k )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ctv | --cache-type-v )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -dt | --defrag-thold )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
KV cache defragmentation threshold (DEPRECATED)
(env: LLAMA_ARG_DEFRAG_THOLD)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -np | --parallel )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of parallel sequences to decode (default: 1)
(env: LLAMA_ARG_N_PARALLEL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rpc )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
comma-separated list of RPC servers (host:port)
(env: LLAMA_ARG_RPC)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -lm | --load-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
model loading mode (default: auto)
- 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)"
            fi
            COMPREPLY=( $(compgen -W 'auto none mmap mlock mmap+mlock dio' -- "$cur") )
            return 0
        ;;
        -lzm | --lazy-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
on-demand reading of certain tensors, for example per-layer embeddings (default: auto)
- on: read the rows of such tensors from disk on demand instead of keeping them resident (requires mmap)
- auto: on, but only for tensors larger than 4 GiB
- off: always keep them resident
(env: LLAMA_ARG_LAZY_MODE)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        --numa )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
attempt optimizations that help on some NUMA systems
- 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)"
            fi
            COMPREPLY=( $(compgen -W 'distribute isolate numactl' -- "$cur") )
            return 0
        ;;
        -dev | --device )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --list-devices )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print list of available devices and exit"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ot | --override-tensor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
override tensor buffer type
(env: LLAMA_ARG_OVERRIDE_TENSOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -cmoe | --cpu-moe )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep all Mixture of Experts (MoE) weights in the CPU
(env: LLAMA_ARG_CPU_MOE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ncmoe | --n-cpu-moe )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep the Mixture of Experts (MoE) weights of the first N layers in the CPU
(env: LLAMA_ARG_N_CPU_MOE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --moe-cache-mib )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
GPU cache size in MiB for the MoE experts kept in the CPU. with multiple GPUs, it is split among them like the layers (--tensor-split) (default: 0, disabled)
(env: LLAMA_ARG_MOE_CACHE_MIB)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ncffn | --n-cpu-ffn )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep the dense FFN weights of the first N layers in the CPU
(dense models; for MoE expert weights use --n-cpu-moe)
(env: LLAMA_ARG_N_CPU_FFN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ngl | --gpu-layers | --n-gpu-layers )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
max. number of layers to store in VRAM, either an exact number, 'auto', or 'all' (default: auto)
(env: LLAMA_ARG_N_GPU_LAYERS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -sm | --split-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
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)"
            fi
            COMPREPLY=( $(compgen -W 'none layer row split' -- "$cur") )
            return 0
        ;;
        -ts | --tensor-split )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
fraction of the model to offload to each GPU, comma-separated list of proportions, e.g. 3,1
(env: LLAMA_ARG_TENSOR_SPLIT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -mg | --main-gpu )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fit | --fit )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
whether to adjust unset arguments to fit in device memory ('on' or 'off', default: 'on')
(env: LLAMA_ARG_FIT)"
            fi
            COMPREPLY=( $(compgen -W 'on off' -- "$cur") )
            return 0
        ;;
        -fitt | --fit-target )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fitc | --fit-ctx )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
minimum ctx size that can be set by --fit option, default: 4096
(env: LLAMA_ARG_FIT_CTX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --check-tensors )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
check model tensor data for invalid values (default: false)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --override-kv )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --op-offload )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to offload host tensor operations to device (default: true)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --lora )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to LoRA adapter (use comma-separated values to load multiple adapters)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --lora-scaled )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to LoRA adapter with user defined scaling (format: FNAME:SCALE,...)
note: use comma-separated values"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add a control vector
note: use comma-separated values to add multiple control vectors"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector-scaled )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add a control vector with user defined scaling SCALE
note: use comma-separated values (format: FNAME:SCALE,...)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector-layer-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
layer range to apply the control vector(s) to, start and end inclusive"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -m | --model )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
model path to load
(env: LLAMA_ARG_MODEL)"
            fi
            COMPREPLY=( $(compgen -f -X '!*.gguf' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -mu | --model-url )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
model download url (default: unused)
(env: LLAMA_ARG_MODEL_URL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -dr | --docker-repo )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Docker Hub model repository. repo is optional, default to ai/. quant is optional, default to :latest.
example: gemma3
(default: unused)
(env: LLAMA_ARG_DOCKER_REPO)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hf | -hfr | --hf-repo )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face model repository; quant is optional, case-insensitive, default to Q4_K_M, or falls back to the first file in the repo if Q4_K_M doesn't exist.
mmproj is also downloaded automatically if available. to disable, add --no-mmproj
example: ggml-org/GLM-4.7-Flash-GGUF:Q4_K_M
(default: unused)
(env: LLAMA_ARG_HF_REPO)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hff | --hf-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face model file. If specified, it will override the quant in --hf-repo (default: unused)
(env: LLAMA_ARG_HF_FILE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hft | --hf-token )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face access token (default: value from HF_TOKEN environment variable)
(env: HF_TOKEN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-disable )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log disable"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log to file
(env: LLAMA_ARG_LOG_FILE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-jsonl )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log as JSONL (one JSON object per line) to stdout, this also disables colored logging (default: disabled)
(env: LLAMA_ARG_LOG_JSONL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-colors )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
Set colored logging ('on', 'off', or 'auto', default: 'auto')
'auto' enables colors when output is to a terminal
(env: LLAMA_ARG_LOG_COLORS)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        -v | --verbose | --log-verbose )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Set verbosity level to infinity (i.e. log all messages, useful for debugging)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --offline )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Offline mode: forces use of cache, prevents network access
(env: LLAMA_ARG_OFFLINE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -lv | --verbosity | --log-verbosity )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Set the verbosity threshold. Messages with a higher verbosity will be ignored. Values:
 - 0: generic output
 - 1: error
 - 2: warning
 - 3: info
 - 4: trace (more info)
 - 5: debug
(default: 3)

(env: LLAMA_ARG_LOG_VERBOSITY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-prefix )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Enable prefix in log messages
(env: LLAMA_ARG_LOG_PREFIX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-timestamps )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Enable timestamps in log messages
(env: LLAMA_ARG_LOG_TIMESTAMPS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-type-k | -ctkd | --cache-type-k-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-type-v | -ctvd | --cache-type-v-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
KV cache data type for V 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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
    esac

case "$curr" in
    -* )
        COMPREPLY=( $(compgen -W "${opts}" -- "$curr") )
        return 0
    ;;
esac
} && complete -F _comp_cmd_llama_idle llama-idle

_comp_cmd_llama_imatrix()
{
    local curr prev opts
    COMPREPLY=()
    curr="${COMP_WORDS[COMP_CWORD]}"
    prev="${COMP_WORDS[COMP_CWORD-1]}"

    opts="
        -h --help --usage
        --version
        -cl --cache-list
        --completion-bash
        -t --threads
        -tb --threads-batch
        -C --cpu-mask
        -Cr --cpu-range
        --cpu-strict
        --prio
        --poll
        -Cb --cpu-mask-batch
        -Crb --cpu-range-batch
        --cpu-strict-batch
        --prio-batch
        --poll-batch
        -c --ctx-size
        -n --predict --n-predict
        -b --batch-size
        -ub --ubatch-size
        --keep
        --swa-full
        -fa --flash-attn
        -p --prompt
        --perf
        -f --file
        -bf --binary-file
        -e --escape
        --rope-scaling
        --rope-scale
        --rope-freq-base
        --rope-freq-scale
        --yarn-orig-ctx
        --yarn-ext-factor
        --yarn-attn-factor
        --yarn-beta-slow
        --yarn-beta-fast
        -kvo --kv-offload
        --repack
        --no-host
        -ctk --cache-type-k
        -ctv --cache-type-v
        -dt --defrag-thold
        -np --parallel
        --rpc
        -lm --load-mode
        -lzm --lazy-mode
        --numa
        -dev --device
        --list-devices
        -ot --override-tensor
        -cmoe --cpu-moe
        -ncmoe --n-cpu-moe
        --moe-cache-mib
        -ncffn --n-cpu-ffn
        -ngl --gpu-layers --n-gpu-layers
        -sm --split-mode
        -ts --tensor-split
        -mg --main-gpu
        -fit --fit
        -fitt --fit-target
        -fitc --fit-ctx
        --check-tensors
        --override-kv
        --op-offload
        --lora
        --lora-scaled
        --control-vector
        --control-vector-scaled
        --control-vector-layer-range
        -m --model
        -mu --model-url
        -dr --docker-repo
        -hf -hfr --hf-repo
        -hff --hf-file
        -hft --hf-token
        --log-disable
        --log-file
        --log-jsonl
        --log-colors
        -v --verbose --log-verbose
        --offline
        -lv --verbosity --log-verbosity
        --log-prefix
        --log-timestamps
        --spec-draft-type-k -ctkd --cache-type-k-draft
        --spec-draft-type-v -ctvd --cache-type-v-draft
        --samplers
        -s --seed
        --sampler-seq --sampling-seq
        --ignore-eos
        --temp --temperature
        --top-k
        --top-p
        --min-p
        --top-nsigma --top-n-sigma
        --xtc-probability
        --xtc-threshold
        --typical --typical-p
        --repeat-last-n
        --repeat-penalty
        --presence-penalty
        --frequency-penalty
        --dry-multiplier
        --dry-base
        --dry-allowed-length
        --dry-penalty-last-n
        --dry-sequence-breaker
        --adaptive-target
        --adaptive-decay
        --dynatemp-range
        --dynatemp-exp
        --mirostat
        --mirostat-lr
        --mirostat-ent
        -l --logit-bias
        --grammar
        --grammar-file
        -j --json-schema
        -jf --json-schema-file
        -bs --backend-sampling
        --spec-draft-model -md --model-draft
        --context-shift
        --chunks
        --in-file
        -o --output --output-file
        -ofreq --output-frequency
        --output-format
        --save-frequency
        --process-output
        --nextn
        --ppl
        --chunk --from-chunk
        --show-statistics
        --parse-special
    "

    case "$prev" in
        -h | --help | --usage )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print usage and exit"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --version )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
show version and build info"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -cl | --cache-list )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
show list of models in cache"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --completion-bash )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print source-able bash completion script for llama.cpp"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -t | --threads )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of CPU threads to use during generation (default: -1)
(env: LLAMA_ARG_THREADS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -tb | --threads-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of threads to use during batch and prompt processing (default: same as --threads)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -C | --cpu-mask )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
CPU affinity mask: arbitrarily long hex. Complements cpu-range (default: \"\")"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Cr | --cpu-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
range of CPUs for affinity. Complements --cpu-mask"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --cpu-strict )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use strict CPU placement (default: 0)
"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --prio )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set process/thread priority : low(-1), normal(0), medium(1), high(2), realtime(3) (default: 0)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --poll )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use polling level to wait for work (0 - no polling, default: 50)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Cb | --cpu-mask-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
CPU affinity mask: arbitrarily long hex. Complements cpu-range-batch (default: same as --cpu-mask)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Crb | --cpu-range-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ranges of CPUs for affinity. Complements --cpu-mask-batch"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --cpu-strict-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use strict CPU placement (default: same as --cpu-strict)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --prio-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set process/thread priority : 0-normal, 1-medium, 2-high, 3-realtime (default: 0)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --poll-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use polling to wait for work (default: same as --poll)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        -c | --ctx-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
size of the prompt context (default: 512, 0 = loaded from model)
(env: LLAMA_ARG_CTX_SIZE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -n | --predict | --n-predict )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of tokens to predict (default: -1, -1 = infinity)
(env: LLAMA_ARG_N_PREDICT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -b | --batch-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
logical maximum batch size (default: 2048)
(env: LLAMA_ARG_BATCH)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ub | --ubatch-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
physical maximum batch size (default: 512)
(env: LLAMA_ARG_UBATCH)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --keep )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of tokens to keep from the initial prompt (default: 0, -1 = all)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --swa-full )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fa | --flash-attn )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
set Flash Attention use ('on', 'off', or 'auto', default: 'auto')
(env: LLAMA_ARG_FLASH_ATTN)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        -p | --prompt )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
prompt to start generation with; for system message, use -sys"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --perf )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable internal libllama performance timings (default: false)
(env: LLAMA_ARG_PERF)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -f | --file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
a file containing the prompt (default: none)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -bf | --binary-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
binary file containing the prompt (default: none)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -e | --escape )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to process escapes sequences (\\n, \\r, \\t, \\', \\\", \\\\) (default: false)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-scaling )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
RoPE frequency scaling method, defaults to linear unless specified by the model
(env: LLAMA_ARG_ROPE_SCALING_TYPE)"
            fi
            COMPREPLY=( $(compgen -W 'none linear yarn' -- "$cur") )
            return 0
        ;;
        --rope-scale )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE context scaling factor, expands context by a factor of N
(env: LLAMA_ARG_ROPE_SCALE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-freq-base )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE base frequency, used by NTK-aware scaling (default: loaded from model)
(env: LLAMA_ARG_ROPE_FREQ_BASE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-freq-scale )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE frequency scaling factor, expands context by a factor of 1/N
(env: LLAMA_ARG_ROPE_FREQ_SCALE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-orig-ctx )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: original context size of model (default: 0 = model training context size)
(env: LLAMA_ARG_YARN_ORIG_CTX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-ext-factor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: extrapolation mix factor (default: -1.00, 0.0 = full interpolation)
(env: LLAMA_ARG_YARN_EXT_FACTOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-attn-factor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: scale sqrt(t) or attention magnitude (default: -1.00)
(env: LLAMA_ARG_YARN_ATTN_FACTOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-beta-slow )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: high correction dim or alpha (default: -1.00)
(env: LLAMA_ARG_YARN_BETA_SLOW)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-beta-fast )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: low correction dim or beta (default: -1.00)
(env: LLAMA_ARG_YARN_BETA_FAST)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -kvo | --kv-offload )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable KV cache offloading (default: enabled)
(env: LLAMA_ARG_KV_OFFLOAD)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repack )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable weight repacking (default: enabled)
(env: LLAMA_ARG_REPACK)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --no-host )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
bypass host buffer allowing extra buffers to be used
(env: LLAMA_ARG_NO_HOST)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ctk | --cache-type-k )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ctv | --cache-type-v )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -dt | --defrag-thold )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
KV cache defragmentation threshold (DEPRECATED)
(env: LLAMA_ARG_DEFRAG_THOLD)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -np | --parallel )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of parallel sequences to decode (default: 1)
(env: LLAMA_ARG_N_PARALLEL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rpc )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
comma-separated list of RPC servers (host:port)
(env: LLAMA_ARG_RPC)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -lm | --load-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
model loading mode (default: auto)
- 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)"
            fi
            COMPREPLY=( $(compgen -W 'auto none mmap mlock mmap+mlock dio' -- "$cur") )
            return 0
        ;;
        -lzm | --lazy-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
on-demand reading of certain tensors, for example per-layer embeddings (default: auto)
- on: read the rows of such tensors from disk on demand instead of keeping them resident (requires mmap)
- auto: on, but only for tensors larger than 4 GiB
- off: always keep them resident
(env: LLAMA_ARG_LAZY_MODE)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        --numa )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
attempt optimizations that help on some NUMA systems
- 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)"
            fi
            COMPREPLY=( $(compgen -W 'distribute isolate numactl' -- "$cur") )
            return 0
        ;;
        -dev | --device )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --list-devices )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print list of available devices and exit"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ot | --override-tensor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
override tensor buffer type
(env: LLAMA_ARG_OVERRIDE_TENSOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -cmoe | --cpu-moe )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep all Mixture of Experts (MoE) weights in the CPU
(env: LLAMA_ARG_CPU_MOE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ncmoe | --n-cpu-moe )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep the Mixture of Experts (MoE) weights of the first N layers in the CPU
(env: LLAMA_ARG_N_CPU_MOE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --moe-cache-mib )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
GPU cache size in MiB for the MoE experts kept in the CPU. with multiple GPUs, it is split among them like the layers (--tensor-split) (default: 0, disabled)
(env: LLAMA_ARG_MOE_CACHE_MIB)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ncffn | --n-cpu-ffn )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep the dense FFN weights of the first N layers in the CPU
(dense models; for MoE expert weights use --n-cpu-moe)
(env: LLAMA_ARG_N_CPU_FFN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ngl | --gpu-layers | --n-gpu-layers )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
max. number of layers to store in VRAM, either an exact number, 'auto', or 'all' (default: auto)
(env: LLAMA_ARG_N_GPU_LAYERS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -sm | --split-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
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)"
            fi
            COMPREPLY=( $(compgen -W 'none layer row split' -- "$cur") )
            return 0
        ;;
        -ts | --tensor-split )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
fraction of the model to offload to each GPU, comma-separated list of proportions, e.g. 3,1
(env: LLAMA_ARG_TENSOR_SPLIT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -mg | --main-gpu )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fit | --fit )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
whether to adjust unset arguments to fit in device memory ('on' or 'off', default: 'on')
(env: LLAMA_ARG_FIT)"
            fi
            COMPREPLY=( $(compgen -W 'on off' -- "$cur") )
            return 0
        ;;
        -fitt | --fit-target )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fitc | --fit-ctx )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
minimum ctx size that can be set by --fit option, default: 4096
(env: LLAMA_ARG_FIT_CTX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --check-tensors )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
check model tensor data for invalid values (default: false)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --override-kv )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --op-offload )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to offload host tensor operations to device (default: true)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --lora )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to LoRA adapter (use comma-separated values to load multiple adapters)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --lora-scaled )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to LoRA adapter with user defined scaling (format: FNAME:SCALE,...)
note: use comma-separated values"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add a control vector
note: use comma-separated values to add multiple control vectors"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector-scaled )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add a control vector with user defined scaling SCALE
note: use comma-separated values (format: FNAME:SCALE,...)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector-layer-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
layer range to apply the control vector(s) to, start and end inclusive"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -m | --model )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
model path to load
(env: LLAMA_ARG_MODEL)"
            fi
            COMPREPLY=( $(compgen -f -X '!*.gguf' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -mu | --model-url )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
model download url (default: unused)
(env: LLAMA_ARG_MODEL_URL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -dr | --docker-repo )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Docker Hub model repository. repo is optional, default to ai/. quant is optional, default to :latest.
example: gemma3
(default: unused)
(env: LLAMA_ARG_DOCKER_REPO)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hf | -hfr | --hf-repo )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face model repository; quant is optional, case-insensitive, default to Q4_K_M, or falls back to the first file in the repo if Q4_K_M doesn't exist.
mmproj is also downloaded automatically if available. to disable, add --no-mmproj
example: ggml-org/GLM-4.7-Flash-GGUF:Q4_K_M
(default: unused)
(env: LLAMA_ARG_HF_REPO)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hff | --hf-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face model file. If specified, it will override the quant in --hf-repo (default: unused)
(env: LLAMA_ARG_HF_FILE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hft | --hf-token )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face access token (default: value from HF_TOKEN environment variable)
(env: HF_TOKEN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-disable )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log disable"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log to file
(env: LLAMA_ARG_LOG_FILE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-jsonl )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log as JSONL (one JSON object per line) to stdout, this also disables colored logging (default: disabled)
(env: LLAMA_ARG_LOG_JSONL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-colors )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
Set colored logging ('on', 'off', or 'auto', default: 'auto')
'auto' enables colors when output is to a terminal
(env: LLAMA_ARG_LOG_COLORS)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        -v | --verbose | --log-verbose )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Set verbosity level to infinity (i.e. log all messages, useful for debugging)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --offline )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Offline mode: forces use of cache, prevents network access
(env: LLAMA_ARG_OFFLINE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -lv | --verbosity | --log-verbosity )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Set the verbosity threshold. Messages with a higher verbosity will be ignored. Values:
 - 0: generic output
 - 1: error
 - 2: warning
 - 3: info
 - 4: trace (more info)
 - 5: debug
(default: 3)

(env: LLAMA_ARG_LOG_VERBOSITY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-prefix )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Enable prefix in log messages
(env: LLAMA_ARG_LOG_PREFIX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-timestamps )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Enable timestamps in log messages
(env: LLAMA_ARG_LOG_TIMESTAMPS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-type-k | -ctkd | --cache-type-k-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-type-v | -ctvd | --cache-type-v-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
KV cache data type for V 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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --samplers )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
samplers that will be used for generation in the order, separated by ';'
(default: penalties;dry;top_n_sigma;top_k;typ_p;top_p;min_p;xtc;temperature)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -s | --seed )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RNG seed (default: -1, use random seed for -1)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --sampler-seq | --sampling-seq )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
simplified sequence for samplers that will be used (default: edskypmxt)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --ignore-eos )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ignore end of stream token and continue generating (implies --logit-bias EOS-inf)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --temp | --temperature )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
temperature (default: 0.80)
(env: LLAMA_ARG_TEMPERATURE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-k )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-k sampling (default: 40, 0 = disabled)
(env: LLAMA_ARG_TOP_K)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-p sampling (default: 0.95, 1.0 = disabled)
(env: LLAMA_ARG_TOP_P)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --min-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
min-p sampling (default: 0.05, 0.0 = disabled)
(env: LLAMA_ARG_MIN_P)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-nsigma | --top-n-sigma )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-n-sigma sampling (default: -1.00, -1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --xtc-probability )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
xtc probability (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --xtc-threshold )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
xtc threshold (default: 0.10, 1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --typical | --typical-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
locally typical sampling, parameter p (default: 1.00, 1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repeat-last-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
last n tokens to consider for penalize (default: 64, 0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repeat-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
penalize repeat sequence of tokens (default: 1.00, 1.0 = disabled)
(env: LLAMA_ARG_REPEAT_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --presence-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
repeat alpha presence penalty (default: 0.00, 0.0 = disabled)
(env: LLAMA_ARG_PRESENCE_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --frequency-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
repeat alpha frequency penalty (default: 0.00, 0.0 = disabled)
(env: LLAMA_ARG_FREQUENCY_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-multiplier )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY sampling multiplier (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-base )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY sampling base value (default: 1.75)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-allowed-length )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set allowed length for DRY sampling (default: 2)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-penalty-last-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY penalty for the last n tokens (default: 64, 0 = disable)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-sequence-breaker )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add sequence breaker for DRY sampling, clearing out default breakers ('\\n', ':', '\"', '*') in the process; use \"none\" to not use any sequence breakers
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --adaptive-target )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
adaptive-p: select tokens near this probability (valid range 0.0 to 1.0; negative = disabled) (default: -1.00)
[(more info)](https://github.com/ggml-org/llama.cpp/pull/17927)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --adaptive-decay )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
adaptive-p: 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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dynatemp-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
dynamic temperature range (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dynatemp-exp )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
dynamic temperature exponent (default: 1.00)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use Mirostat sampling.
Top K, Nucleus and Locally Typical samplers are ignored if used.
(default: 0, 0 = disabled, 1 = Mirostat, 2 = Mirostat 2.0)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat-lr )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Mirostat learning rate, parameter eta (default: 0.10)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat-ent )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Mirostat target entropy, parameter tau (default: 5.00)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -l | --logit-bias )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
modifies the likelihood of token appearing in the completion,
i.e. \`--logit-bias 15043+1\` to increase likelihood of token ' Hello',
or \`--logit-bias 15043-1\` to decrease likelihood of token ' Hello'"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --grammar )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
BNF-like grammar to constrain generations (see samples in grammars/ dir)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --grammar-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
file to read grammar from"
            fi
            COMPREPLY=( $(compgen -f -X '!*.gbnf' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -j | --json-schema )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
JSON schema to constrain generations (https://json-schema.org/), e.g. \`{\"type\": \"object\"}\` for any JSON object"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -jf | --json-schema-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
File containing a JSON schema to constrain generations (https://json-schema.org/), e.g. \`{\"type\": \"object\"}\` for any JSON object"
            fi
            COMPREPLY=( $(compgen -f -X '!*.json' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -bs | --backend-sampling )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
enable backend sampling (experimental) (default: disabled)
(env: LLAMA_ARG_BACKEND_SAMPLING)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-model | -md | --model-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
draft model for speculative decoding (default: unused)
(env: LLAMA_ARG_SPEC_DRAFT_MODEL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --context-shift )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to use context shift on infinite text generation (default: disabled)
(env: LLAMA_ARG_CONTEXT_SHIFT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --chunks )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
max number of chunks to process (default: -1, -1 = all)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --in-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
an input file (use comma-separated values to specify multiple files)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -o | --output | --output-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
output file (default: 'imatrix.gguf')"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ofreq | --output-frequency )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
output the imatrix every N iterations (default: 10)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --output-format )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
output format for imatrix file (default: gguf)"
            fi
            COMPREPLY=( $(compgen -W 'gguf dat' -- "$cur") )
            return 0
        ;;
        --save-frequency )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
save an imatrix copy every N iterations (default: 0)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --process-output )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
collect data for the output tensor (default: false)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --nextn )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
collect data for MTP/NextN layers (default: false)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --ppl )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to compute perplexity (default: true)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --chunk | --from-chunk )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
start processing the input from chunk N (default: 0)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --show-statistics )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
show imatrix statistics and then exit (default: false)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --parse-special )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
parse special tokens (chat, tool, etc) (default: false)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
    esac

case "$curr" in
    -* )
        COMPREPLY=( $(compgen -W "${opts}" -- "$curr") )
        return 0
    ;;
esac
} && complete -F _comp_cmd_llama_imatrix llama-imatrix

_comp_cmd_llama_lookahead()
{
    local curr prev opts
    COMPREPLY=()
    curr="${COMP_WORDS[COMP_CWORD]}"
    prev="${COMP_WORDS[COMP_CWORD-1]}"

    opts="
        --samplers
        -s --seed
        --sampler-seq --sampling-seq
        --ignore-eos
        --temp --temperature
        --top-k
        --top-p
        --min-p
        --top-nsigma --top-n-sigma
        --xtc-probability
        --xtc-threshold
        --typical --typical-p
        --repeat-last-n
        --repeat-penalty
        --presence-penalty
        --frequency-penalty
        --dry-multiplier
        --dry-base
        --dry-allowed-length
        --dry-penalty-last-n
        --dry-sequence-breaker
        --adaptive-target
        --adaptive-decay
        --dynatemp-range
        --dynatemp-exp
        --mirostat
        --mirostat-lr
        --mirostat-ent
        -l --logit-bias
        --grammar
        --grammar-file
        -j --json-schema
        -jf --json-schema-file
        -bs --backend-sampling
        -h --help --usage
        --version
        -cl --cache-list
        --completion-bash
        -t --threads
        -tb --threads-batch
        -C --cpu-mask
        -Cr --cpu-range
        --cpu-strict
        --prio
        --poll
        -Cb --cpu-mask-batch
        -Crb --cpu-range-batch
        --cpu-strict-batch
        --prio-batch
        --poll-batch
        -c --ctx-size
        -n --predict --n-predict
        -b --batch-size
        -ub --ubatch-size
        --keep
        --swa-full
        -fa --flash-attn
        -p --prompt
        --perf
        -f --file
        -bf --binary-file
        -e --escape
        --rope-scaling
        --rope-scale
        --rope-freq-base
        --rope-freq-scale
        --yarn-orig-ctx
        --yarn-ext-factor
        --yarn-attn-factor
        --yarn-beta-slow
        --yarn-beta-fast
        -kvo --kv-offload
        --repack
        --no-host
        -ctk --cache-type-k
        -ctv --cache-type-v
        -dt --defrag-thold
        -np --parallel
        --rpc
        -lm --load-mode
        -lzm --lazy-mode
        --numa
        -dev --device
        --list-devices
        -ot --override-tensor
        -cmoe --cpu-moe
        -ncmoe --n-cpu-moe
        --moe-cache-mib
        -ncffn --n-cpu-ffn
        -ngl --gpu-layers --n-gpu-layers
        -sm --split-mode
        -ts --tensor-split
        -mg --main-gpu
        -fit --fit
        -fitt --fit-target
        -fitc --fit-ctx
        --check-tensors
        --override-kv
        --op-offload
        --lora
        --lora-scaled
        --control-vector
        --control-vector-scaled
        --control-vector-layer-range
        -m --model
        -mu --model-url
        -dr --docker-repo
        -hf -hfr --hf-repo
        -hff --hf-file
        -hft --hf-token
        --log-disable
        --log-file
        --log-jsonl
        --log-colors
        -v --verbose --log-verbose
        --offline
        -lv --verbosity --log-verbosity
        --log-prefix
        --log-timestamps
        --spec-draft-type-k -ctkd --cache-type-k-draft
        --spec-draft-type-v -ctvd --cache-type-v-draft
    "

    case "$prev" in
        --samplers )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
samplers that will be used for generation in the order, separated by ';'
(default: penalties;dry;top_n_sigma;top_k;typ_p;top_p;min_p;xtc;temperature)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -s | --seed )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RNG seed (default: -1, use random seed for -1)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --sampler-seq | --sampling-seq )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
simplified sequence for samplers that will be used (default: edskypmxt)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --ignore-eos )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ignore end of stream token and continue generating (implies --logit-bias EOS-inf)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --temp | --temperature )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
temperature (default: 0.80)
(env: LLAMA_ARG_TEMPERATURE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-k )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-k sampling (default: 40, 0 = disabled)
(env: LLAMA_ARG_TOP_K)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-p sampling (default: 0.95, 1.0 = disabled)
(env: LLAMA_ARG_TOP_P)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --min-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
min-p sampling (default: 0.05, 0.0 = disabled)
(env: LLAMA_ARG_MIN_P)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-nsigma | --top-n-sigma )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-n-sigma sampling (default: -1.00, -1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --xtc-probability )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
xtc probability (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --xtc-threshold )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
xtc threshold (default: 0.10, 1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --typical | --typical-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
locally typical sampling, parameter p (default: 1.00, 1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repeat-last-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
last n tokens to consider for penalize (default: 64, 0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repeat-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
penalize repeat sequence of tokens (default: 1.00, 1.0 = disabled)
(env: LLAMA_ARG_REPEAT_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --presence-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
repeat alpha presence penalty (default: 0.00, 0.0 = disabled)
(env: LLAMA_ARG_PRESENCE_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --frequency-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
repeat alpha frequency penalty (default: 0.00, 0.0 = disabled)
(env: LLAMA_ARG_FREQUENCY_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-multiplier )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY sampling multiplier (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-base )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY sampling base value (default: 1.75)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-allowed-length )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set allowed length for DRY sampling (default: 2)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-penalty-last-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY penalty for the last n tokens (default: 64, 0 = disable)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-sequence-breaker )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add sequence breaker for DRY sampling, clearing out default breakers ('\\n', ':', '\"', '*') in the process; use \"none\" to not use any sequence breakers
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --adaptive-target )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
adaptive-p: select tokens near this probability (valid range 0.0 to 1.0; negative = disabled) (default: -1.00)
[(more info)](https://github.com/ggml-org/llama.cpp/pull/17927)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --adaptive-decay )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
adaptive-p: 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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dynatemp-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
dynamic temperature range (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dynatemp-exp )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
dynamic temperature exponent (default: 1.00)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use Mirostat sampling.
Top K, Nucleus and Locally Typical samplers are ignored if used.
(default: 0, 0 = disabled, 1 = Mirostat, 2 = Mirostat 2.0)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat-lr )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Mirostat learning rate, parameter eta (default: 0.10)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat-ent )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Mirostat target entropy, parameter tau (default: 5.00)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -l | --logit-bias )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
modifies the likelihood of token appearing in the completion,
i.e. \`--logit-bias 15043+1\` to increase likelihood of token ' Hello',
or \`--logit-bias 15043-1\` to decrease likelihood of token ' Hello'"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --grammar )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
BNF-like grammar to constrain generations (see samples in grammars/ dir)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --grammar-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
file to read grammar from"
            fi
            COMPREPLY=( $(compgen -f -X '!*.gbnf' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -j | --json-schema )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
JSON schema to constrain generations (https://json-schema.org/), e.g. \`{\"type\": \"object\"}\` for any JSON object"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -jf | --json-schema-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
File containing a JSON schema to constrain generations (https://json-schema.org/), e.g. \`{\"type\": \"object\"}\` for any JSON object"
            fi
            COMPREPLY=( $(compgen -f -X '!*.json' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -bs | --backend-sampling )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
enable backend sampling (experimental) (default: disabled)
(env: LLAMA_ARG_BACKEND_SAMPLING)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -h | --help | --usage )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print usage and exit"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --version )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
show version and build info"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -cl | --cache-list )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
show list of models in cache"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --completion-bash )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print source-able bash completion script for llama.cpp"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -t | --threads )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of CPU threads to use during generation (default: -1)
(env: LLAMA_ARG_THREADS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -tb | --threads-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of threads to use during batch and prompt processing (default: same as --threads)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -C | --cpu-mask )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
CPU affinity mask: arbitrarily long hex. Complements cpu-range (default: \"\")"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Cr | --cpu-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
range of CPUs for affinity. Complements --cpu-mask"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --cpu-strict )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use strict CPU placement (default: 0)
"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --prio )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set process/thread priority : low(-1), normal(0), medium(1), high(2), realtime(3) (default: 0)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --poll )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use polling level to wait for work (0 - no polling, default: 50)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Cb | --cpu-mask-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
CPU affinity mask: arbitrarily long hex. Complements cpu-range-batch (default: same as --cpu-mask)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Crb | --cpu-range-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ranges of CPUs for affinity. Complements --cpu-mask-batch"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --cpu-strict-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use strict CPU placement (default: same as --cpu-strict)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --prio-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set process/thread priority : 0-normal, 1-medium, 2-high, 3-realtime (default: 0)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --poll-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use polling to wait for work (default: same as --poll)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        -c | --ctx-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
size of the prompt context (default: 0, 0 = loaded from model)
(env: LLAMA_ARG_CTX_SIZE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -n | --predict | --n-predict )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of tokens to predict (default: -1, -1 = infinity)
(env: LLAMA_ARG_N_PREDICT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -b | --batch-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
logical maximum batch size (default: 2048)
(env: LLAMA_ARG_BATCH)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ub | --ubatch-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
physical maximum batch size (default: 512)
(env: LLAMA_ARG_UBATCH)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --keep )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of tokens to keep from the initial prompt (default: 0, -1 = all)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --swa-full )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fa | --flash-attn )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
set Flash Attention use ('on', 'off', or 'auto', default: 'auto')
(env: LLAMA_ARG_FLASH_ATTN)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        -p | --prompt )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
prompt to start generation with; for system message, use -sys"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --perf )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable internal libllama performance timings (default: false)
(env: LLAMA_ARG_PERF)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -f | --file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
a file containing the prompt (default: none)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -bf | --binary-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
binary file containing the prompt (default: none)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -e | --escape )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to process escapes sequences (\\n, \\r, \\t, \\', \\\", \\\\) (default: true)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-scaling )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
RoPE frequency scaling method, defaults to linear unless specified by the model
(env: LLAMA_ARG_ROPE_SCALING_TYPE)"
            fi
            COMPREPLY=( $(compgen -W 'none linear yarn' -- "$cur") )
            return 0
        ;;
        --rope-scale )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE context scaling factor, expands context by a factor of N
(env: LLAMA_ARG_ROPE_SCALE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-freq-base )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE base frequency, used by NTK-aware scaling (default: loaded from model)
(env: LLAMA_ARG_ROPE_FREQ_BASE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-freq-scale )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE frequency scaling factor, expands context by a factor of 1/N
(env: LLAMA_ARG_ROPE_FREQ_SCALE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-orig-ctx )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: original context size of model (default: 0 = model training context size)
(env: LLAMA_ARG_YARN_ORIG_CTX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-ext-factor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: extrapolation mix factor (default: -1.00, 0.0 = full interpolation)
(env: LLAMA_ARG_YARN_EXT_FACTOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-attn-factor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: scale sqrt(t) or attention magnitude (default: -1.00)
(env: LLAMA_ARG_YARN_ATTN_FACTOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-beta-slow )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: high correction dim or alpha (default: -1.00)
(env: LLAMA_ARG_YARN_BETA_SLOW)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-beta-fast )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: low correction dim or beta (default: -1.00)
(env: LLAMA_ARG_YARN_BETA_FAST)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -kvo | --kv-offload )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable KV cache offloading (default: enabled)
(env: LLAMA_ARG_KV_OFFLOAD)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repack )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable weight repacking (default: enabled)
(env: LLAMA_ARG_REPACK)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --no-host )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
bypass host buffer allowing extra buffers to be used
(env: LLAMA_ARG_NO_HOST)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ctk | --cache-type-k )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ctv | --cache-type-v )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -dt | --defrag-thold )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
KV cache defragmentation threshold (DEPRECATED)
(env: LLAMA_ARG_DEFRAG_THOLD)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -np | --parallel )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of parallel sequences to decode (default: 1)
(env: LLAMA_ARG_N_PARALLEL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rpc )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
comma-separated list of RPC servers (host:port)
(env: LLAMA_ARG_RPC)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -lm | --load-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
model loading mode (default: auto)
- 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)"
            fi
            COMPREPLY=( $(compgen -W 'auto none mmap mlock mmap+mlock dio' -- "$cur") )
            return 0
        ;;
        -lzm | --lazy-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
on-demand reading of certain tensors, for example per-layer embeddings (default: auto)
- on: read the rows of such tensors from disk on demand instead of keeping them resident (requires mmap)
- auto: on, but only for tensors larger than 4 GiB
- off: always keep them resident
(env: LLAMA_ARG_LAZY_MODE)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        --numa )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
attempt optimizations that help on some NUMA systems
- 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)"
            fi
            COMPREPLY=( $(compgen -W 'distribute isolate numactl' -- "$cur") )
            return 0
        ;;
        -dev | --device )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --list-devices )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print list of available devices and exit"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ot | --override-tensor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
override tensor buffer type
(env: LLAMA_ARG_OVERRIDE_TENSOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -cmoe | --cpu-moe )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep all Mixture of Experts (MoE) weights in the CPU
(env: LLAMA_ARG_CPU_MOE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ncmoe | --n-cpu-moe )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep the Mixture of Experts (MoE) weights of the first N layers in the CPU
(env: LLAMA_ARG_N_CPU_MOE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --moe-cache-mib )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
GPU cache size in MiB for the MoE experts kept in the CPU. with multiple GPUs, it is split among them like the layers (--tensor-split) (default: 0, disabled)
(env: LLAMA_ARG_MOE_CACHE_MIB)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ncffn | --n-cpu-ffn )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep the dense FFN weights of the first N layers in the CPU
(dense models; for MoE expert weights use --n-cpu-moe)
(env: LLAMA_ARG_N_CPU_FFN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ngl | --gpu-layers | --n-gpu-layers )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
max. number of layers to store in VRAM, either an exact number, 'auto', or 'all' (default: auto)
(env: LLAMA_ARG_N_GPU_LAYERS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -sm | --split-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
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)"
            fi
            COMPREPLY=( $(compgen -W 'none layer row split' -- "$cur") )
            return 0
        ;;
        -ts | --tensor-split )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
fraction of the model to offload to each GPU, comma-separated list of proportions, e.g. 3,1
(env: LLAMA_ARG_TENSOR_SPLIT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -mg | --main-gpu )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fit | --fit )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
whether to adjust unset arguments to fit in device memory ('on' or 'off', default: 'on')
(env: LLAMA_ARG_FIT)"
            fi
            COMPREPLY=( $(compgen -W 'on off' -- "$cur") )
            return 0
        ;;
        -fitt | --fit-target )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fitc | --fit-ctx )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
minimum ctx size that can be set by --fit option, default: 4096
(env: LLAMA_ARG_FIT_CTX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --check-tensors )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
check model tensor data for invalid values (default: false)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --override-kv )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --op-offload )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to offload host tensor operations to device (default: true)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --lora )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to LoRA adapter (use comma-separated values to load multiple adapters)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --lora-scaled )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to LoRA adapter with user defined scaling (format: FNAME:SCALE,...)
note: use comma-separated values"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add a control vector
note: use comma-separated values to add multiple control vectors"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector-scaled )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add a control vector with user defined scaling SCALE
note: use comma-separated values (format: FNAME:SCALE,...)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector-layer-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
layer range to apply the control vector(s) to, start and end inclusive"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -m | --model )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
model path to load
(env: LLAMA_ARG_MODEL)"
            fi
            COMPREPLY=( $(compgen -f -X '!*.gguf' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -mu | --model-url )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
model download url (default: unused)
(env: LLAMA_ARG_MODEL_URL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -dr | --docker-repo )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Docker Hub model repository. repo is optional, default to ai/. quant is optional, default to :latest.
example: gemma3
(default: unused)
(env: LLAMA_ARG_DOCKER_REPO)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hf | -hfr | --hf-repo )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face model repository; quant is optional, case-insensitive, default to Q4_K_M, or falls back to the first file in the repo if Q4_K_M doesn't exist.
mmproj is also downloaded automatically if available. to disable, add --no-mmproj
example: ggml-org/GLM-4.7-Flash-GGUF:Q4_K_M
(default: unused)
(env: LLAMA_ARG_HF_REPO)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hff | --hf-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face model file. If specified, it will override the quant in --hf-repo (default: unused)
(env: LLAMA_ARG_HF_FILE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hft | --hf-token )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face access token (default: value from HF_TOKEN environment variable)
(env: HF_TOKEN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-disable )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log disable"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log to file
(env: LLAMA_ARG_LOG_FILE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-jsonl )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log as JSONL (one JSON object per line) to stdout, this also disables colored logging (default: disabled)
(env: LLAMA_ARG_LOG_JSONL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-colors )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
Set colored logging ('on', 'off', or 'auto', default: 'auto')
'auto' enables colors when output is to a terminal
(env: LLAMA_ARG_LOG_COLORS)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        -v | --verbose | --log-verbose )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Set verbosity level to infinity (i.e. log all messages, useful for debugging)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --offline )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Offline mode: forces use of cache, prevents network access
(env: LLAMA_ARG_OFFLINE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -lv | --verbosity | --log-verbosity )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Set the verbosity threshold. Messages with a higher verbosity will be ignored. Values:
 - 0: generic output
 - 1: error
 - 2: warning
 - 3: info
 - 4: trace (more info)
 - 5: debug
(default: 3)

(env: LLAMA_ARG_LOG_VERBOSITY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-prefix )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Enable prefix in log messages
(env: LLAMA_ARG_LOG_PREFIX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-timestamps )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Enable timestamps in log messages
(env: LLAMA_ARG_LOG_TIMESTAMPS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-type-k | -ctkd | --cache-type-k-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-type-v | -ctvd | --cache-type-v-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
KV cache data type for V 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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
    esac

case "$curr" in
    -* )
        COMPREPLY=( $(compgen -W "${opts}" -- "$curr") )
        return 0
    ;;
esac
} && complete -F _comp_cmd_llama_lookahead llama-lookahead

_comp_cmd_llama_lookup()
{
    local curr prev opts
    COMPREPLY=()
    curr="${COMP_WORDS[COMP_CWORD]}"
    prev="${COMP_WORDS[COMP_CWORD-1]}"

    opts="
        -h --help --usage
        --version
        -cl --cache-list
        --completion-bash
        -t --threads
        -tb --threads-batch
        -C --cpu-mask
        -Cr --cpu-range
        --cpu-strict
        --prio
        --poll
        -Cb --cpu-mask-batch
        -Crb --cpu-range-batch
        --cpu-strict-batch
        --prio-batch
        --poll-batch
        -c --ctx-size
        -n --predict --n-predict
        -b --batch-size
        -ub --ubatch-size
        --keep
        --swa-full
        -fa --flash-attn
        -p --prompt
        --perf
        -f --file
        -bf --binary-file
        -e --escape
        --rope-scaling
        --rope-scale
        --rope-freq-base
        --rope-freq-scale
        --yarn-orig-ctx
        --yarn-ext-factor
        --yarn-attn-factor
        --yarn-beta-slow
        --yarn-beta-fast
        -kvo --kv-offload
        --repack
        --no-host
        -ctk --cache-type-k
        -ctv --cache-type-v
        -dt --defrag-thold
        -np --parallel
        --rpc
        -lm --load-mode
        -lzm --lazy-mode
        --numa
        -dev --device
        --list-devices
        -ot --override-tensor
        -cmoe --cpu-moe
        -ncmoe --n-cpu-moe
        --moe-cache-mib
        -ncffn --n-cpu-ffn
        -ngl --gpu-layers --n-gpu-layers
        -sm --split-mode
        -ts --tensor-split
        -mg --main-gpu
        -fit --fit
        -fitt --fit-target
        -fitc --fit-ctx
        --check-tensors
        --override-kv
        --op-offload
        --lora
        --lora-scaled
        --control-vector
        --control-vector-scaled
        --control-vector-layer-range
        -m --model
        -mu --model-url
        -dr --docker-repo
        -hf -hfr --hf-repo
        -hff --hf-file
        -hft --hf-token
        --log-disable
        --log-file
        --log-jsonl
        --log-colors
        -v --verbose --log-verbose
        --offline
        -lv --verbosity --log-verbosity
        --log-prefix
        --log-timestamps
        --spec-draft-type-k -ctkd --cache-type-k-draft
        --spec-draft-type-v -ctvd --cache-type-v-draft
        --samplers
        -s --seed
        --sampler-seq --sampling-seq
        --ignore-eos
        --temp --temperature
        --top-k
        --top-p
        --min-p
        --top-nsigma --top-n-sigma
        --xtc-probability
        --xtc-threshold
        --typical --typical-p
        --repeat-last-n
        --repeat-penalty
        --presence-penalty
        --frequency-penalty
        --dry-multiplier
        --dry-base
        --dry-allowed-length
        --dry-penalty-last-n
        --dry-sequence-breaker
        --adaptive-target
        --adaptive-decay
        --dynatemp-range
        --dynatemp-exp
        --mirostat
        --mirostat-lr
        --mirostat-ent
        -l --logit-bias
        --grammar
        --grammar-file
        -j --json-schema
        -jf --json-schema-file
        -bs --backend-sampling
        --spec-draft-n-max
        --spec-draft-n-min
        --draft --draft-n --draft-max
        --draft-min --draft-n-min
        -co --color
        -lcs --lookup-cache-static
        -lcd --lookup-cache-dynamic
    "

    case "$prev" in
        -h | --help | --usage )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print usage and exit"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --version )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
show version and build info"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -cl | --cache-list )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
show list of models in cache"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --completion-bash )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print source-able bash completion script for llama.cpp"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -t | --threads )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of CPU threads to use during generation (default: -1)
(env: LLAMA_ARG_THREADS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -tb | --threads-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of threads to use during batch and prompt processing (default: same as --threads)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -C | --cpu-mask )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
CPU affinity mask: arbitrarily long hex. Complements cpu-range (default: \"\")"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Cr | --cpu-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
range of CPUs for affinity. Complements --cpu-mask"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --cpu-strict )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use strict CPU placement (default: 0)
"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --prio )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set process/thread priority : low(-1), normal(0), medium(1), high(2), realtime(3) (default: 0)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --poll )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use polling level to wait for work (0 - no polling, default: 50)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Cb | --cpu-mask-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
CPU affinity mask: arbitrarily long hex. Complements cpu-range-batch (default: same as --cpu-mask)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Crb | --cpu-range-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ranges of CPUs for affinity. Complements --cpu-mask-batch"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --cpu-strict-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use strict CPU placement (default: same as --cpu-strict)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --prio-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set process/thread priority : 0-normal, 1-medium, 2-high, 3-realtime (default: 0)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --poll-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use polling to wait for work (default: same as --poll)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        -c | --ctx-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
size of the prompt context (default: 0, 0 = loaded from model)
(env: LLAMA_ARG_CTX_SIZE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -n | --predict | --n-predict )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of tokens to predict (default: -1, -1 = infinity)
(env: LLAMA_ARG_N_PREDICT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -b | --batch-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
logical maximum batch size (default: 2048)
(env: LLAMA_ARG_BATCH)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ub | --ubatch-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
physical maximum batch size (default: 512)
(env: LLAMA_ARG_UBATCH)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --keep )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of tokens to keep from the initial prompt (default: 0, -1 = all)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --swa-full )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fa | --flash-attn )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
set Flash Attention use ('on', 'off', or 'auto', default: 'auto')
(env: LLAMA_ARG_FLASH_ATTN)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        -p | --prompt )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
prompt to start generation with; for system message, use -sys"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --perf )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable internal libllama performance timings (default: false)
(env: LLAMA_ARG_PERF)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -f | --file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
a file containing the prompt (default: none)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -bf | --binary-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
binary file containing the prompt (default: none)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -e | --escape )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to process escapes sequences (\\n, \\r, \\t, \\', \\\", \\\\) (default: true)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-scaling )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
RoPE frequency scaling method, defaults to linear unless specified by the model
(env: LLAMA_ARG_ROPE_SCALING_TYPE)"
            fi
            COMPREPLY=( $(compgen -W 'none linear yarn' -- "$cur") )
            return 0
        ;;
        --rope-scale )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE context scaling factor, expands context by a factor of N
(env: LLAMA_ARG_ROPE_SCALE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-freq-base )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE base frequency, used by NTK-aware scaling (default: loaded from model)
(env: LLAMA_ARG_ROPE_FREQ_BASE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-freq-scale )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE frequency scaling factor, expands context by a factor of 1/N
(env: LLAMA_ARG_ROPE_FREQ_SCALE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-orig-ctx )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: original context size of model (default: 0 = model training context size)
(env: LLAMA_ARG_YARN_ORIG_CTX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-ext-factor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: extrapolation mix factor (default: -1.00, 0.0 = full interpolation)
(env: LLAMA_ARG_YARN_EXT_FACTOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-attn-factor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: scale sqrt(t) or attention magnitude (default: -1.00)
(env: LLAMA_ARG_YARN_ATTN_FACTOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-beta-slow )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: high correction dim or alpha (default: -1.00)
(env: LLAMA_ARG_YARN_BETA_SLOW)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-beta-fast )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: low correction dim or beta (default: -1.00)
(env: LLAMA_ARG_YARN_BETA_FAST)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -kvo | --kv-offload )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable KV cache offloading (default: enabled)
(env: LLAMA_ARG_KV_OFFLOAD)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repack )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable weight repacking (default: enabled)
(env: LLAMA_ARG_REPACK)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --no-host )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
bypass host buffer allowing extra buffers to be used
(env: LLAMA_ARG_NO_HOST)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ctk | --cache-type-k )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ctv | --cache-type-v )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -dt | --defrag-thold )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
KV cache defragmentation threshold (DEPRECATED)
(env: LLAMA_ARG_DEFRAG_THOLD)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -np | --parallel )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of parallel sequences to decode (default: 1)
(env: LLAMA_ARG_N_PARALLEL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rpc )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
comma-separated list of RPC servers (host:port)
(env: LLAMA_ARG_RPC)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -lm | --load-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
model loading mode (default: auto)
- 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)"
            fi
            COMPREPLY=( $(compgen -W 'auto none mmap mlock mmap+mlock dio' -- "$cur") )
            return 0
        ;;
        -lzm | --lazy-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
on-demand reading of certain tensors, for example per-layer embeddings (default: auto)
- on: read the rows of such tensors from disk on demand instead of keeping them resident (requires mmap)
- auto: on, but only for tensors larger than 4 GiB
- off: always keep them resident
(env: LLAMA_ARG_LAZY_MODE)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        --numa )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
attempt optimizations that help on some NUMA systems
- 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)"
            fi
            COMPREPLY=( $(compgen -W 'distribute isolate numactl' -- "$cur") )
            return 0
        ;;
        -dev | --device )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --list-devices )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print list of available devices and exit"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ot | --override-tensor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
override tensor buffer type
(env: LLAMA_ARG_OVERRIDE_TENSOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -cmoe | --cpu-moe )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep all Mixture of Experts (MoE) weights in the CPU
(env: LLAMA_ARG_CPU_MOE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ncmoe | --n-cpu-moe )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep the Mixture of Experts (MoE) weights of the first N layers in the CPU
(env: LLAMA_ARG_N_CPU_MOE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --moe-cache-mib )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
GPU cache size in MiB for the MoE experts kept in the CPU. with multiple GPUs, it is split among them like the layers (--tensor-split) (default: 0, disabled)
(env: LLAMA_ARG_MOE_CACHE_MIB)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ncffn | --n-cpu-ffn )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep the dense FFN weights of the first N layers in the CPU
(dense models; for MoE expert weights use --n-cpu-moe)
(env: LLAMA_ARG_N_CPU_FFN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ngl | --gpu-layers | --n-gpu-layers )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
max. number of layers to store in VRAM, either an exact number, 'auto', or 'all' (default: auto)
(env: LLAMA_ARG_N_GPU_LAYERS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -sm | --split-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
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)"
            fi
            COMPREPLY=( $(compgen -W 'none layer row split' -- "$cur") )
            return 0
        ;;
        -ts | --tensor-split )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
fraction of the model to offload to each GPU, comma-separated list of proportions, e.g. 3,1
(env: LLAMA_ARG_TENSOR_SPLIT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -mg | --main-gpu )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fit | --fit )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
whether to adjust unset arguments to fit in device memory ('on' or 'off', default: 'on')
(env: LLAMA_ARG_FIT)"
            fi
            COMPREPLY=( $(compgen -W 'on off' -- "$cur") )
            return 0
        ;;
        -fitt | --fit-target )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fitc | --fit-ctx )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
minimum ctx size that can be set by --fit option, default: 4096
(env: LLAMA_ARG_FIT_CTX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --check-tensors )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
check model tensor data for invalid values (default: false)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --override-kv )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --op-offload )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to offload host tensor operations to device (default: true)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --lora )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to LoRA adapter (use comma-separated values to load multiple adapters)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --lora-scaled )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to LoRA adapter with user defined scaling (format: FNAME:SCALE,...)
note: use comma-separated values"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add a control vector
note: use comma-separated values to add multiple control vectors"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector-scaled )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add a control vector with user defined scaling SCALE
note: use comma-separated values (format: FNAME:SCALE,...)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector-layer-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
layer range to apply the control vector(s) to, start and end inclusive"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -m | --model )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
model path to load
(env: LLAMA_ARG_MODEL)"
            fi
            COMPREPLY=( $(compgen -f -X '!*.gguf' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -mu | --model-url )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
model download url (default: unused)
(env: LLAMA_ARG_MODEL_URL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -dr | --docker-repo )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Docker Hub model repository. repo is optional, default to ai/. quant is optional, default to :latest.
example: gemma3
(default: unused)
(env: LLAMA_ARG_DOCKER_REPO)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hf | -hfr | --hf-repo )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face model repository; quant is optional, case-insensitive, default to Q4_K_M, or falls back to the first file in the repo if Q4_K_M doesn't exist.
mmproj is also downloaded automatically if available. to disable, add --no-mmproj
example: ggml-org/GLM-4.7-Flash-GGUF:Q4_K_M
(default: unused)
(env: LLAMA_ARG_HF_REPO)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hff | --hf-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face model file. If specified, it will override the quant in --hf-repo (default: unused)
(env: LLAMA_ARG_HF_FILE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hft | --hf-token )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face access token (default: value from HF_TOKEN environment variable)
(env: HF_TOKEN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-disable )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log disable"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log to file
(env: LLAMA_ARG_LOG_FILE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-jsonl )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log as JSONL (one JSON object per line) to stdout, this also disables colored logging (default: disabled)
(env: LLAMA_ARG_LOG_JSONL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-colors )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
Set colored logging ('on', 'off', or 'auto', default: 'auto')
'auto' enables colors when output is to a terminal
(env: LLAMA_ARG_LOG_COLORS)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        -v | --verbose | --log-verbose )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Set verbosity level to infinity (i.e. log all messages, useful for debugging)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --offline )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Offline mode: forces use of cache, prevents network access
(env: LLAMA_ARG_OFFLINE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -lv | --verbosity | --log-verbosity )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Set the verbosity threshold. Messages with a higher verbosity will be ignored. Values:
 - 0: generic output
 - 1: error
 - 2: warning
 - 3: info
 - 4: trace (more info)
 - 5: debug
(default: 3)

(env: LLAMA_ARG_LOG_VERBOSITY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-prefix )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Enable prefix in log messages
(env: LLAMA_ARG_LOG_PREFIX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-timestamps )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Enable timestamps in log messages
(env: LLAMA_ARG_LOG_TIMESTAMPS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-type-k | -ctkd | --cache-type-k-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-type-v | -ctvd | --cache-type-v-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
KV cache data type for V 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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --samplers )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
samplers that will be used for generation in the order, separated by ';'
(default: penalties;dry;top_n_sigma;top_k;typ_p;top_p;min_p;xtc;temperature)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -s | --seed )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RNG seed (default: -1, use random seed for -1)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --sampler-seq | --sampling-seq )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
simplified sequence for samplers that will be used (default: edskypmxt)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --ignore-eos )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ignore end of stream token and continue generating (implies --logit-bias EOS-inf)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --temp | --temperature )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
temperature (default: 0.80)
(env: LLAMA_ARG_TEMPERATURE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-k )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-k sampling (default: 40, 0 = disabled)
(env: LLAMA_ARG_TOP_K)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-p sampling (default: 0.95, 1.0 = disabled)
(env: LLAMA_ARG_TOP_P)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --min-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
min-p sampling (default: 0.05, 0.0 = disabled)
(env: LLAMA_ARG_MIN_P)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-nsigma | --top-n-sigma )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-n-sigma sampling (default: -1.00, -1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --xtc-probability )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
xtc probability (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --xtc-threshold )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
xtc threshold (default: 0.10, 1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --typical | --typical-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
locally typical sampling, parameter p (default: 1.00, 1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repeat-last-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
last n tokens to consider for penalize (default: 64, 0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repeat-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
penalize repeat sequence of tokens (default: 1.00, 1.0 = disabled)
(env: LLAMA_ARG_REPEAT_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --presence-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
repeat alpha presence penalty (default: 0.00, 0.0 = disabled)
(env: LLAMA_ARG_PRESENCE_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --frequency-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
repeat alpha frequency penalty (default: 0.00, 0.0 = disabled)
(env: LLAMA_ARG_FREQUENCY_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-multiplier )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY sampling multiplier (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-base )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY sampling base value (default: 1.75)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-allowed-length )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set allowed length for DRY sampling (default: 2)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-penalty-last-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY penalty for the last n tokens (default: 64, 0 = disable)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-sequence-breaker )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add sequence breaker for DRY sampling, clearing out default breakers ('\\n', ':', '\"', '*') in the process; use \"none\" to not use any sequence breakers
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --adaptive-target )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
adaptive-p: select tokens near this probability (valid range 0.0 to 1.0; negative = disabled) (default: -1.00)
[(more info)](https://github.com/ggml-org/llama.cpp/pull/17927)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --adaptive-decay )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
adaptive-p: 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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dynatemp-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
dynamic temperature range (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dynatemp-exp )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
dynamic temperature exponent (default: 1.00)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use Mirostat sampling.
Top K, Nucleus and Locally Typical samplers are ignored if used.
(default: 0, 0 = disabled, 1 = Mirostat, 2 = Mirostat 2.0)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat-lr )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Mirostat learning rate, parameter eta (default: 0.10)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat-ent )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Mirostat target entropy, parameter tau (default: 5.00)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -l | --logit-bias )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
modifies the likelihood of token appearing in the completion,
i.e. \`--logit-bias 15043+1\` to increase likelihood of token ' Hello',
or \`--logit-bias 15043-1\` to decrease likelihood of token ' Hello'"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --grammar )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
BNF-like grammar to constrain generations (see samples in grammars/ dir)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --grammar-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
file to read grammar from"
            fi
            COMPREPLY=( $(compgen -f -X '!*.gbnf' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -j | --json-schema )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
JSON schema to constrain generations (https://json-schema.org/), e.g. \`{\"type\": \"object\"}\` for any JSON object"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -jf | --json-schema-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
File containing a JSON schema to constrain generations (https://json-schema.org/), e.g. \`{\"type\": \"object\"}\` for any JSON object"
            fi
            COMPREPLY=( $(compgen -f -X '!*.json' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -bs | --backend-sampling )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
enable backend sampling (experimental) (default: disabled)
(env: LLAMA_ARG_BACKEND_SAMPLING)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-n-max )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of tokens to draft for speculative decoding (default: 3)
(env: LLAMA_ARG_SPEC_DRAFT_N_MAX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-n-min )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
minimum number of draft tokens to use for speculative decoding (default: 0)
(env: LLAMA_ARG_SPEC_DRAFT_N_MIN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --draft | --draft-n | --draft-max )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
the argument has been removed. use --spec-draft-n-max or --spec-ngram-mod-n-max
(env: LLAMA_ARG_DRAFT_MAX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --draft-min | --draft-n-min )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
the argument has been removed. use --spec-draft-n-min or --spec-ngram-mod-n-min
(env: LLAMA_ARG_DRAFT_MIN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -co | --color )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
Colorize output to distinguish prompt and user input from generations ('on', 'off', or 'auto', default: 'auto')
'auto' enables colors when output is to a terminal"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        -lcs | --lookup-cache-static )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to static lookup cache to use for lookup decoding (not updated by generation)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -lcd | --lookup-cache-dynamic )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to dynamic lookup cache to use for lookup decoding (updated by generation)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
    esac

case "$curr" in
    -* )
        COMPREPLY=( $(compgen -W "${opts}" -- "$curr") )
        return 0
    ;;
esac
} && complete -F _comp_cmd_llama_lookup llama-lookup

_comp_cmd_llama_lookup_create()
{
    local curr prev opts
    COMPREPLY=()
    curr="${COMP_WORDS[COMP_CWORD]}"
    prev="${COMP_WORDS[COMP_CWORD-1]}"

    opts="
        -h --help --usage
        --version
        -cl --cache-list
        --completion-bash
        -t --threads
        -tb --threads-batch
        -C --cpu-mask
        -Cr --cpu-range
        --cpu-strict
        --prio
        --poll
        -Cb --cpu-mask-batch
        -Crb --cpu-range-batch
        --cpu-strict-batch
        --prio-batch
        --poll-batch
        -c --ctx-size
        -n --predict --n-predict
        -b --batch-size
        -ub --ubatch-size
        --keep
        --swa-full
        -fa --flash-attn
        -p --prompt
        --perf
        -f --file
        -bf --binary-file
        -e --escape
        --rope-scaling
        --rope-scale
        --rope-freq-base
        --rope-freq-scale
        --yarn-orig-ctx
        --yarn-ext-factor
        --yarn-attn-factor
        --yarn-beta-slow
        --yarn-beta-fast
        -kvo --kv-offload
        --repack
        --no-host
        -ctk --cache-type-k
        -ctv --cache-type-v
        -dt --defrag-thold
        -np --parallel
        --rpc
        -lm --load-mode
        -lzm --lazy-mode
        --numa
        -dev --device
        --list-devices
        -ot --override-tensor
        -cmoe --cpu-moe
        -ncmoe --n-cpu-moe
        --moe-cache-mib
        -ncffn --n-cpu-ffn
        -ngl --gpu-layers --n-gpu-layers
        -sm --split-mode
        -ts --tensor-split
        -mg --main-gpu
        -fit --fit
        -fitt --fit-target
        -fitc --fit-ctx
        --check-tensors
        --override-kv
        --op-offload
        --lora
        --lora-scaled
        --control-vector
        --control-vector-scaled
        --control-vector-layer-range
        -m --model
        -mu --model-url
        -dr --docker-repo
        -hf -hfr --hf-repo
        -hff --hf-file
        -hft --hf-token
        --log-disable
        --log-file
        --log-jsonl
        --log-colors
        -v --verbose --log-verbose
        --offline
        -lv --verbosity --log-verbosity
        --log-prefix
        --log-timestamps
        --spec-draft-type-k -ctkd --cache-type-k-draft
        --spec-draft-type-v -ctvd --cache-type-v-draft
        --samplers
        -s --seed
        --sampler-seq --sampling-seq
        --ignore-eos
        --temp --temperature
        --top-k
        --top-p
        --min-p
        --top-nsigma --top-n-sigma
        --xtc-probability
        --xtc-threshold
        --typical --typical-p
        --repeat-last-n
        --repeat-penalty
        --presence-penalty
        --frequency-penalty
        --dry-multiplier
        --dry-base
        --dry-allowed-length
        --dry-penalty-last-n
        --dry-sequence-breaker
        --adaptive-target
        --adaptive-decay
        --dynatemp-range
        --dynatemp-exp
        --mirostat
        --mirostat-lr
        --mirostat-ent
        -l --logit-bias
        --grammar
        --grammar-file
        -j --json-schema
        -jf --json-schema-file
        -bs --backend-sampling
        --spec-draft-n-max
        --spec-draft-n-min
        --draft --draft-n --draft-max
        --draft-min --draft-n-min
        -co --color
        -lcs --lookup-cache-static
        -lcd --lookup-cache-dynamic
    "

    case "$prev" in
        -h | --help | --usage )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print usage and exit"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --version )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
show version and build info"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -cl | --cache-list )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
show list of models in cache"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --completion-bash )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print source-able bash completion script for llama.cpp"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -t | --threads )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of CPU threads to use during generation (default: -1)
(env: LLAMA_ARG_THREADS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -tb | --threads-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of threads to use during batch and prompt processing (default: same as --threads)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -C | --cpu-mask )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
CPU affinity mask: arbitrarily long hex. Complements cpu-range (default: \"\")"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Cr | --cpu-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
range of CPUs for affinity. Complements --cpu-mask"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --cpu-strict )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use strict CPU placement (default: 0)
"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --prio )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set process/thread priority : low(-1), normal(0), medium(1), high(2), realtime(3) (default: 0)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --poll )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use polling level to wait for work (0 - no polling, default: 50)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Cb | --cpu-mask-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
CPU affinity mask: arbitrarily long hex. Complements cpu-range-batch (default: same as --cpu-mask)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Crb | --cpu-range-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ranges of CPUs for affinity. Complements --cpu-mask-batch"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --cpu-strict-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use strict CPU placement (default: same as --cpu-strict)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --prio-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set process/thread priority : 0-normal, 1-medium, 2-high, 3-realtime (default: 0)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --poll-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use polling to wait for work (default: same as --poll)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        -c | --ctx-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
size of the prompt context (default: 0, 0 = loaded from model)
(env: LLAMA_ARG_CTX_SIZE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -n | --predict | --n-predict )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of tokens to predict (default: -1, -1 = infinity)
(env: LLAMA_ARG_N_PREDICT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -b | --batch-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
logical maximum batch size (default: 2048)
(env: LLAMA_ARG_BATCH)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ub | --ubatch-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
physical maximum batch size (default: 512)
(env: LLAMA_ARG_UBATCH)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --keep )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of tokens to keep from the initial prompt (default: 0, -1 = all)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --swa-full )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fa | --flash-attn )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
set Flash Attention use ('on', 'off', or 'auto', default: 'auto')
(env: LLAMA_ARG_FLASH_ATTN)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        -p | --prompt )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
prompt to start generation with; for system message, use -sys"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --perf )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable internal libllama performance timings (default: false)
(env: LLAMA_ARG_PERF)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -f | --file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
a file containing the prompt (default: none)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -bf | --binary-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
binary file containing the prompt (default: none)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -e | --escape )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to process escapes sequences (\\n, \\r, \\t, \\', \\\", \\\\) (default: true)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-scaling )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
RoPE frequency scaling method, defaults to linear unless specified by the model
(env: LLAMA_ARG_ROPE_SCALING_TYPE)"
            fi
            COMPREPLY=( $(compgen -W 'none linear yarn' -- "$cur") )
            return 0
        ;;
        --rope-scale )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE context scaling factor, expands context by a factor of N
(env: LLAMA_ARG_ROPE_SCALE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-freq-base )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE base frequency, used by NTK-aware scaling (default: loaded from model)
(env: LLAMA_ARG_ROPE_FREQ_BASE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-freq-scale )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE frequency scaling factor, expands context by a factor of 1/N
(env: LLAMA_ARG_ROPE_FREQ_SCALE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-orig-ctx )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: original context size of model (default: 0 = model training context size)
(env: LLAMA_ARG_YARN_ORIG_CTX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-ext-factor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: extrapolation mix factor (default: -1.00, 0.0 = full interpolation)
(env: LLAMA_ARG_YARN_EXT_FACTOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-attn-factor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: scale sqrt(t) or attention magnitude (default: -1.00)
(env: LLAMA_ARG_YARN_ATTN_FACTOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-beta-slow )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: high correction dim or alpha (default: -1.00)
(env: LLAMA_ARG_YARN_BETA_SLOW)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-beta-fast )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: low correction dim or beta (default: -1.00)
(env: LLAMA_ARG_YARN_BETA_FAST)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -kvo | --kv-offload )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable KV cache offloading (default: enabled)
(env: LLAMA_ARG_KV_OFFLOAD)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repack )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable weight repacking (default: enabled)
(env: LLAMA_ARG_REPACK)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --no-host )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
bypass host buffer allowing extra buffers to be used
(env: LLAMA_ARG_NO_HOST)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ctk | --cache-type-k )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ctv | --cache-type-v )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -dt | --defrag-thold )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
KV cache defragmentation threshold (DEPRECATED)
(env: LLAMA_ARG_DEFRAG_THOLD)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -np | --parallel )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of parallel sequences to decode (default: 1)
(env: LLAMA_ARG_N_PARALLEL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rpc )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
comma-separated list of RPC servers (host:port)
(env: LLAMA_ARG_RPC)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -lm | --load-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
model loading mode (default: auto)
- 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)"
            fi
            COMPREPLY=( $(compgen -W 'auto none mmap mlock mmap+mlock dio' -- "$cur") )
            return 0
        ;;
        -lzm | --lazy-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
on-demand reading of certain tensors, for example per-layer embeddings (default: auto)
- on: read the rows of such tensors from disk on demand instead of keeping them resident (requires mmap)
- auto: on, but only for tensors larger than 4 GiB
- off: always keep them resident
(env: LLAMA_ARG_LAZY_MODE)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        --numa )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
attempt optimizations that help on some NUMA systems
- 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)"
            fi
            COMPREPLY=( $(compgen -W 'distribute isolate numactl' -- "$cur") )
            return 0
        ;;
        -dev | --device )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --list-devices )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print list of available devices and exit"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ot | --override-tensor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
override tensor buffer type
(env: LLAMA_ARG_OVERRIDE_TENSOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -cmoe | --cpu-moe )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep all Mixture of Experts (MoE) weights in the CPU
(env: LLAMA_ARG_CPU_MOE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ncmoe | --n-cpu-moe )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep the Mixture of Experts (MoE) weights of the first N layers in the CPU
(env: LLAMA_ARG_N_CPU_MOE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --moe-cache-mib )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
GPU cache size in MiB for the MoE experts kept in the CPU. with multiple GPUs, it is split among them like the layers (--tensor-split) (default: 0, disabled)
(env: LLAMA_ARG_MOE_CACHE_MIB)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ncffn | --n-cpu-ffn )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep the dense FFN weights of the first N layers in the CPU
(dense models; for MoE expert weights use --n-cpu-moe)
(env: LLAMA_ARG_N_CPU_FFN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ngl | --gpu-layers | --n-gpu-layers )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
max. number of layers to store in VRAM, either an exact number, 'auto', or 'all' (default: auto)
(env: LLAMA_ARG_N_GPU_LAYERS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -sm | --split-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
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)"
            fi
            COMPREPLY=( $(compgen -W 'none layer row split' -- "$cur") )
            return 0
        ;;
        -ts | --tensor-split )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
fraction of the model to offload to each GPU, comma-separated list of proportions, e.g. 3,1
(env: LLAMA_ARG_TENSOR_SPLIT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -mg | --main-gpu )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fit | --fit )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
whether to adjust unset arguments to fit in device memory ('on' or 'off', default: 'on')
(env: LLAMA_ARG_FIT)"
            fi
            COMPREPLY=( $(compgen -W 'on off' -- "$cur") )
            return 0
        ;;
        -fitt | --fit-target )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fitc | --fit-ctx )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
minimum ctx size that can be set by --fit option, default: 4096
(env: LLAMA_ARG_FIT_CTX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --check-tensors )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
check model tensor data for invalid values (default: false)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --override-kv )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --op-offload )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to offload host tensor operations to device (default: true)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --lora )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to LoRA adapter (use comma-separated values to load multiple adapters)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --lora-scaled )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to LoRA adapter with user defined scaling (format: FNAME:SCALE,...)
note: use comma-separated values"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add a control vector
note: use comma-separated values to add multiple control vectors"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector-scaled )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add a control vector with user defined scaling SCALE
note: use comma-separated values (format: FNAME:SCALE,...)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector-layer-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
layer range to apply the control vector(s) to, start and end inclusive"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -m | --model )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
model path to load
(env: LLAMA_ARG_MODEL)"
            fi
            COMPREPLY=( $(compgen -f -X '!*.gguf' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -mu | --model-url )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
model download url (default: unused)
(env: LLAMA_ARG_MODEL_URL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -dr | --docker-repo )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Docker Hub model repository. repo is optional, default to ai/. quant is optional, default to :latest.
example: gemma3
(default: unused)
(env: LLAMA_ARG_DOCKER_REPO)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hf | -hfr | --hf-repo )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face model repository; quant is optional, case-insensitive, default to Q4_K_M, or falls back to the first file in the repo if Q4_K_M doesn't exist.
mmproj is also downloaded automatically if available. to disable, add --no-mmproj
example: ggml-org/GLM-4.7-Flash-GGUF:Q4_K_M
(default: unused)
(env: LLAMA_ARG_HF_REPO)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hff | --hf-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face model file. If specified, it will override the quant in --hf-repo (default: unused)
(env: LLAMA_ARG_HF_FILE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hft | --hf-token )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face access token (default: value from HF_TOKEN environment variable)
(env: HF_TOKEN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-disable )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log disable"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log to file
(env: LLAMA_ARG_LOG_FILE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-jsonl )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log as JSONL (one JSON object per line) to stdout, this also disables colored logging (default: disabled)
(env: LLAMA_ARG_LOG_JSONL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-colors )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
Set colored logging ('on', 'off', or 'auto', default: 'auto')
'auto' enables colors when output is to a terminal
(env: LLAMA_ARG_LOG_COLORS)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        -v | --verbose | --log-verbose )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Set verbosity level to infinity (i.e. log all messages, useful for debugging)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --offline )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Offline mode: forces use of cache, prevents network access
(env: LLAMA_ARG_OFFLINE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -lv | --verbosity | --log-verbosity )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Set the verbosity threshold. Messages with a higher verbosity will be ignored. Values:
 - 0: generic output
 - 1: error
 - 2: warning
 - 3: info
 - 4: trace (more info)
 - 5: debug
(default: 3)

(env: LLAMA_ARG_LOG_VERBOSITY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-prefix )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Enable prefix in log messages
(env: LLAMA_ARG_LOG_PREFIX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-timestamps )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Enable timestamps in log messages
(env: LLAMA_ARG_LOG_TIMESTAMPS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-type-k | -ctkd | --cache-type-k-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-type-v | -ctvd | --cache-type-v-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
KV cache data type for V 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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --samplers )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
samplers that will be used for generation in the order, separated by ';'
(default: penalties;dry;top_n_sigma;top_k;typ_p;top_p;min_p;xtc;temperature)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -s | --seed )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RNG seed (default: -1, use random seed for -1)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --sampler-seq | --sampling-seq )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
simplified sequence for samplers that will be used (default: edskypmxt)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --ignore-eos )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ignore end of stream token and continue generating (implies --logit-bias EOS-inf)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --temp | --temperature )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
temperature (default: 0.80)
(env: LLAMA_ARG_TEMPERATURE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-k )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-k sampling (default: 40, 0 = disabled)
(env: LLAMA_ARG_TOP_K)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-p sampling (default: 0.95, 1.0 = disabled)
(env: LLAMA_ARG_TOP_P)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --min-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
min-p sampling (default: 0.05, 0.0 = disabled)
(env: LLAMA_ARG_MIN_P)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-nsigma | --top-n-sigma )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-n-sigma sampling (default: -1.00, -1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --xtc-probability )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
xtc probability (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --xtc-threshold )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
xtc threshold (default: 0.10, 1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --typical | --typical-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
locally typical sampling, parameter p (default: 1.00, 1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repeat-last-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
last n tokens to consider for penalize (default: 64, 0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repeat-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
penalize repeat sequence of tokens (default: 1.00, 1.0 = disabled)
(env: LLAMA_ARG_REPEAT_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --presence-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
repeat alpha presence penalty (default: 0.00, 0.0 = disabled)
(env: LLAMA_ARG_PRESENCE_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --frequency-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
repeat alpha frequency penalty (default: 0.00, 0.0 = disabled)
(env: LLAMA_ARG_FREQUENCY_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-multiplier )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY sampling multiplier (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-base )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY sampling base value (default: 1.75)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-allowed-length )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set allowed length for DRY sampling (default: 2)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-penalty-last-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY penalty for the last n tokens (default: 64, 0 = disable)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-sequence-breaker )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add sequence breaker for DRY sampling, clearing out default breakers ('\\n', ':', '\"', '*') in the process; use \"none\" to not use any sequence breakers
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --adaptive-target )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
adaptive-p: select tokens near this probability (valid range 0.0 to 1.0; negative = disabled) (default: -1.00)
[(more info)](https://github.com/ggml-org/llama.cpp/pull/17927)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --adaptive-decay )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
adaptive-p: 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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dynatemp-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
dynamic temperature range (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dynatemp-exp )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
dynamic temperature exponent (default: 1.00)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use Mirostat sampling.
Top K, Nucleus and Locally Typical samplers are ignored if used.
(default: 0, 0 = disabled, 1 = Mirostat, 2 = Mirostat 2.0)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat-lr )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Mirostat learning rate, parameter eta (default: 0.10)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat-ent )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Mirostat target entropy, parameter tau (default: 5.00)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -l | --logit-bias )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
modifies the likelihood of token appearing in the completion,
i.e. \`--logit-bias 15043+1\` to increase likelihood of token ' Hello',
or \`--logit-bias 15043-1\` to decrease likelihood of token ' Hello'"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --grammar )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
BNF-like grammar to constrain generations (see samples in grammars/ dir)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --grammar-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
file to read grammar from"
            fi
            COMPREPLY=( $(compgen -f -X '!*.gbnf' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -j | --json-schema )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
JSON schema to constrain generations (https://json-schema.org/), e.g. \`{\"type\": \"object\"}\` for any JSON object"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -jf | --json-schema-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
File containing a JSON schema to constrain generations (https://json-schema.org/), e.g. \`{\"type\": \"object\"}\` for any JSON object"
            fi
            COMPREPLY=( $(compgen -f -X '!*.json' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -bs | --backend-sampling )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
enable backend sampling (experimental) (default: disabled)
(env: LLAMA_ARG_BACKEND_SAMPLING)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-n-max )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of tokens to draft for speculative decoding (default: 3)
(env: LLAMA_ARG_SPEC_DRAFT_N_MAX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-n-min )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
minimum number of draft tokens to use for speculative decoding (default: 0)
(env: LLAMA_ARG_SPEC_DRAFT_N_MIN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --draft | --draft-n | --draft-max )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
the argument has been removed. use --spec-draft-n-max or --spec-ngram-mod-n-max
(env: LLAMA_ARG_DRAFT_MAX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --draft-min | --draft-n-min )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
the argument has been removed. use --spec-draft-n-min or --spec-ngram-mod-n-min
(env: LLAMA_ARG_DRAFT_MIN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -co | --color )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
Colorize output to distinguish prompt and user input from generations ('on', 'off', or 'auto', default: 'auto')
'auto' enables colors when output is to a terminal"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        -lcs | --lookup-cache-static )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to static lookup cache to use for lookup decoding (not updated by generation)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -lcd | --lookup-cache-dynamic )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to dynamic lookup cache to use for lookup decoding (updated by generation)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
    esac

case "$curr" in
    -* )
        COMPREPLY=( $(compgen -W "${opts}" -- "$curr") )
        return 0
    ;;
esac
} && complete -F _comp_cmd_llama_lookup_create llama-lookup-create

_comp_cmd_llama_lookup_stats()
{
    local curr prev opts
    COMPREPLY=()
    curr="${COMP_WORDS[COMP_CWORD]}"
    prev="${COMP_WORDS[COMP_CWORD-1]}"

    opts="
        -h --help --usage
        --version
        -cl --cache-list
        --completion-bash
        -t --threads
        -tb --threads-batch
        -C --cpu-mask
        -Cr --cpu-range
        --cpu-strict
        --prio
        --poll
        -Cb --cpu-mask-batch
        -Crb --cpu-range-batch
        --cpu-strict-batch
        --prio-batch
        --poll-batch
        -c --ctx-size
        -n --predict --n-predict
        -b --batch-size
        -ub --ubatch-size
        --keep
        --swa-full
        -fa --flash-attn
        -p --prompt
        --perf
        -f --file
        -bf --binary-file
        -e --escape
        --rope-scaling
        --rope-scale
        --rope-freq-base
        --rope-freq-scale
        --yarn-orig-ctx
        --yarn-ext-factor
        --yarn-attn-factor
        --yarn-beta-slow
        --yarn-beta-fast
        -kvo --kv-offload
        --repack
        --no-host
        -ctk --cache-type-k
        -ctv --cache-type-v
        -dt --defrag-thold
        -np --parallel
        --rpc
        -lm --load-mode
        -lzm --lazy-mode
        --numa
        -dev --device
        --list-devices
        -ot --override-tensor
        -cmoe --cpu-moe
        -ncmoe --n-cpu-moe
        --moe-cache-mib
        -ncffn --n-cpu-ffn
        -ngl --gpu-layers --n-gpu-layers
        -sm --split-mode
        -ts --tensor-split
        -mg --main-gpu
        -fit --fit
        -fitt --fit-target
        -fitc --fit-ctx
        --check-tensors
        --override-kv
        --op-offload
        --lora
        --lora-scaled
        --control-vector
        --control-vector-scaled
        --control-vector-layer-range
        -m --model
        -mu --model-url
        -dr --docker-repo
        -hf -hfr --hf-repo
        -hff --hf-file
        -hft --hf-token
        --log-disable
        --log-file
        --log-jsonl
        --log-colors
        -v --verbose --log-verbose
        --offline
        -lv --verbosity --log-verbosity
        --log-prefix
        --log-timestamps
        --spec-draft-type-k -ctkd --cache-type-k-draft
        --spec-draft-type-v -ctvd --cache-type-v-draft
        --samplers
        -s --seed
        --sampler-seq --sampling-seq
        --ignore-eos
        --temp --temperature
        --top-k
        --top-p
        --min-p
        --top-nsigma --top-n-sigma
        --xtc-probability
        --xtc-threshold
        --typical --typical-p
        --repeat-last-n
        --repeat-penalty
        --presence-penalty
        --frequency-penalty
        --dry-multiplier
        --dry-base
        --dry-allowed-length
        --dry-penalty-last-n
        --dry-sequence-breaker
        --adaptive-target
        --adaptive-decay
        --dynatemp-range
        --dynatemp-exp
        --mirostat
        --mirostat-lr
        --mirostat-ent
        -l --logit-bias
        --grammar
        --grammar-file
        -j --json-schema
        -jf --json-schema-file
        -bs --backend-sampling
        --spec-draft-n-max
        --spec-draft-n-min
        --draft --draft-n --draft-max
        --draft-min --draft-n-min
        -co --color
        -lcs --lookup-cache-static
        -lcd --lookup-cache-dynamic
    "

    case "$prev" in
        -h | --help | --usage )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print usage and exit"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --version )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
show version and build info"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -cl | --cache-list )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
show list of models in cache"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --completion-bash )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print source-able bash completion script for llama.cpp"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -t | --threads )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of CPU threads to use during generation (default: -1)
(env: LLAMA_ARG_THREADS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -tb | --threads-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of threads to use during batch and prompt processing (default: same as --threads)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -C | --cpu-mask )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
CPU affinity mask: arbitrarily long hex. Complements cpu-range (default: \"\")"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Cr | --cpu-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
range of CPUs for affinity. Complements --cpu-mask"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --cpu-strict )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use strict CPU placement (default: 0)
"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --prio )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set process/thread priority : low(-1), normal(0), medium(1), high(2), realtime(3) (default: 0)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --poll )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use polling level to wait for work (0 - no polling, default: 50)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Cb | --cpu-mask-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
CPU affinity mask: arbitrarily long hex. Complements cpu-range-batch (default: same as --cpu-mask)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Crb | --cpu-range-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ranges of CPUs for affinity. Complements --cpu-mask-batch"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --cpu-strict-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use strict CPU placement (default: same as --cpu-strict)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --prio-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set process/thread priority : 0-normal, 1-medium, 2-high, 3-realtime (default: 0)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --poll-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use polling to wait for work (default: same as --poll)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        -c | --ctx-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
size of the prompt context (default: 0, 0 = loaded from model)
(env: LLAMA_ARG_CTX_SIZE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -n | --predict | --n-predict )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of tokens to predict (default: -1, -1 = infinity)
(env: LLAMA_ARG_N_PREDICT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -b | --batch-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
logical maximum batch size (default: 2048)
(env: LLAMA_ARG_BATCH)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ub | --ubatch-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
physical maximum batch size (default: 512)
(env: LLAMA_ARG_UBATCH)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --keep )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of tokens to keep from the initial prompt (default: 0, -1 = all)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --swa-full )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fa | --flash-attn )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
set Flash Attention use ('on', 'off', or 'auto', default: 'auto')
(env: LLAMA_ARG_FLASH_ATTN)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        -p | --prompt )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
prompt to start generation with; for system message, use -sys"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --perf )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable internal libllama performance timings (default: false)
(env: LLAMA_ARG_PERF)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -f | --file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
a file containing the prompt (default: none)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -bf | --binary-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
binary file containing the prompt (default: none)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -e | --escape )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to process escapes sequences (\\n, \\r, \\t, \\', \\\", \\\\) (default: true)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-scaling )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
RoPE frequency scaling method, defaults to linear unless specified by the model
(env: LLAMA_ARG_ROPE_SCALING_TYPE)"
            fi
            COMPREPLY=( $(compgen -W 'none linear yarn' -- "$cur") )
            return 0
        ;;
        --rope-scale )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE context scaling factor, expands context by a factor of N
(env: LLAMA_ARG_ROPE_SCALE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-freq-base )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE base frequency, used by NTK-aware scaling (default: loaded from model)
(env: LLAMA_ARG_ROPE_FREQ_BASE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-freq-scale )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE frequency scaling factor, expands context by a factor of 1/N
(env: LLAMA_ARG_ROPE_FREQ_SCALE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-orig-ctx )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: original context size of model (default: 0 = model training context size)
(env: LLAMA_ARG_YARN_ORIG_CTX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-ext-factor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: extrapolation mix factor (default: -1.00, 0.0 = full interpolation)
(env: LLAMA_ARG_YARN_EXT_FACTOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-attn-factor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: scale sqrt(t) or attention magnitude (default: -1.00)
(env: LLAMA_ARG_YARN_ATTN_FACTOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-beta-slow )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: high correction dim or alpha (default: -1.00)
(env: LLAMA_ARG_YARN_BETA_SLOW)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-beta-fast )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: low correction dim or beta (default: -1.00)
(env: LLAMA_ARG_YARN_BETA_FAST)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -kvo | --kv-offload )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable KV cache offloading (default: enabled)
(env: LLAMA_ARG_KV_OFFLOAD)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repack )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable weight repacking (default: enabled)
(env: LLAMA_ARG_REPACK)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --no-host )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
bypass host buffer allowing extra buffers to be used
(env: LLAMA_ARG_NO_HOST)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ctk | --cache-type-k )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ctv | --cache-type-v )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -dt | --defrag-thold )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
KV cache defragmentation threshold (DEPRECATED)
(env: LLAMA_ARG_DEFRAG_THOLD)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -np | --parallel )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of parallel sequences to decode (default: 1)
(env: LLAMA_ARG_N_PARALLEL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rpc )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
comma-separated list of RPC servers (host:port)
(env: LLAMA_ARG_RPC)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -lm | --load-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
model loading mode (default: auto)
- 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)"
            fi
            COMPREPLY=( $(compgen -W 'auto none mmap mlock mmap+mlock dio' -- "$cur") )
            return 0
        ;;
        -lzm | --lazy-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
on-demand reading of certain tensors, for example per-layer embeddings (default: auto)
- on: read the rows of such tensors from disk on demand instead of keeping them resident (requires mmap)
- auto: on, but only for tensors larger than 4 GiB
- off: always keep them resident
(env: LLAMA_ARG_LAZY_MODE)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        --numa )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
attempt optimizations that help on some NUMA systems
- 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)"
            fi
            COMPREPLY=( $(compgen -W 'distribute isolate numactl' -- "$cur") )
            return 0
        ;;
        -dev | --device )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --list-devices )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print list of available devices and exit"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ot | --override-tensor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
override tensor buffer type
(env: LLAMA_ARG_OVERRIDE_TENSOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -cmoe | --cpu-moe )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep all Mixture of Experts (MoE) weights in the CPU
(env: LLAMA_ARG_CPU_MOE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ncmoe | --n-cpu-moe )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep the Mixture of Experts (MoE) weights of the first N layers in the CPU
(env: LLAMA_ARG_N_CPU_MOE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --moe-cache-mib )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
GPU cache size in MiB for the MoE experts kept in the CPU. with multiple GPUs, it is split among them like the layers (--tensor-split) (default: 0, disabled)
(env: LLAMA_ARG_MOE_CACHE_MIB)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ncffn | --n-cpu-ffn )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep the dense FFN weights of the first N layers in the CPU
(dense models; for MoE expert weights use --n-cpu-moe)
(env: LLAMA_ARG_N_CPU_FFN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ngl | --gpu-layers | --n-gpu-layers )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
max. number of layers to store in VRAM, either an exact number, 'auto', or 'all' (default: auto)
(env: LLAMA_ARG_N_GPU_LAYERS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -sm | --split-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
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)"
            fi
            COMPREPLY=( $(compgen -W 'none layer row split' -- "$cur") )
            return 0
        ;;
        -ts | --tensor-split )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
fraction of the model to offload to each GPU, comma-separated list of proportions, e.g. 3,1
(env: LLAMA_ARG_TENSOR_SPLIT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -mg | --main-gpu )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fit | --fit )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
whether to adjust unset arguments to fit in device memory ('on' or 'off', default: 'on')
(env: LLAMA_ARG_FIT)"
            fi
            COMPREPLY=( $(compgen -W 'on off' -- "$cur") )
            return 0
        ;;
        -fitt | --fit-target )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fitc | --fit-ctx )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
minimum ctx size that can be set by --fit option, default: 4096
(env: LLAMA_ARG_FIT_CTX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --check-tensors )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
check model tensor data for invalid values (default: false)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --override-kv )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --op-offload )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to offload host tensor operations to device (default: true)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --lora )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to LoRA adapter (use comma-separated values to load multiple adapters)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --lora-scaled )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to LoRA adapter with user defined scaling (format: FNAME:SCALE,...)
note: use comma-separated values"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add a control vector
note: use comma-separated values to add multiple control vectors"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector-scaled )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add a control vector with user defined scaling SCALE
note: use comma-separated values (format: FNAME:SCALE,...)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector-layer-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
layer range to apply the control vector(s) to, start and end inclusive"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -m | --model )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
model path to load
(env: LLAMA_ARG_MODEL)"
            fi
            COMPREPLY=( $(compgen -f -X '!*.gguf' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -mu | --model-url )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
model download url (default: unused)
(env: LLAMA_ARG_MODEL_URL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -dr | --docker-repo )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Docker Hub model repository. repo is optional, default to ai/. quant is optional, default to :latest.
example: gemma3
(default: unused)
(env: LLAMA_ARG_DOCKER_REPO)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hf | -hfr | --hf-repo )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face model repository; quant is optional, case-insensitive, default to Q4_K_M, or falls back to the first file in the repo if Q4_K_M doesn't exist.
mmproj is also downloaded automatically if available. to disable, add --no-mmproj
example: ggml-org/GLM-4.7-Flash-GGUF:Q4_K_M
(default: unused)
(env: LLAMA_ARG_HF_REPO)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hff | --hf-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face model file. If specified, it will override the quant in --hf-repo (default: unused)
(env: LLAMA_ARG_HF_FILE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hft | --hf-token )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face access token (default: value from HF_TOKEN environment variable)
(env: HF_TOKEN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-disable )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log disable"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log to file
(env: LLAMA_ARG_LOG_FILE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-jsonl )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log as JSONL (one JSON object per line) to stdout, this also disables colored logging (default: disabled)
(env: LLAMA_ARG_LOG_JSONL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-colors )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
Set colored logging ('on', 'off', or 'auto', default: 'auto')
'auto' enables colors when output is to a terminal
(env: LLAMA_ARG_LOG_COLORS)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        -v | --verbose | --log-verbose )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Set verbosity level to infinity (i.e. log all messages, useful for debugging)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --offline )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Offline mode: forces use of cache, prevents network access
(env: LLAMA_ARG_OFFLINE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -lv | --verbosity | --log-verbosity )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Set the verbosity threshold. Messages with a higher verbosity will be ignored. Values:
 - 0: generic output
 - 1: error
 - 2: warning
 - 3: info
 - 4: trace (more info)
 - 5: debug
(default: 3)

(env: LLAMA_ARG_LOG_VERBOSITY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-prefix )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Enable prefix in log messages
(env: LLAMA_ARG_LOG_PREFIX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-timestamps )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Enable timestamps in log messages
(env: LLAMA_ARG_LOG_TIMESTAMPS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-type-k | -ctkd | --cache-type-k-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-type-v | -ctvd | --cache-type-v-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
KV cache data type for V 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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --samplers )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
samplers that will be used for generation in the order, separated by ';'
(default: penalties;dry;top_n_sigma;top_k;typ_p;top_p;min_p;xtc;temperature)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -s | --seed )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RNG seed (default: -1, use random seed for -1)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --sampler-seq | --sampling-seq )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
simplified sequence for samplers that will be used (default: edskypmxt)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --ignore-eos )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ignore end of stream token and continue generating (implies --logit-bias EOS-inf)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --temp | --temperature )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
temperature (default: 0.80)
(env: LLAMA_ARG_TEMPERATURE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-k )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-k sampling (default: 40, 0 = disabled)
(env: LLAMA_ARG_TOP_K)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-p sampling (default: 0.95, 1.0 = disabled)
(env: LLAMA_ARG_TOP_P)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --min-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
min-p sampling (default: 0.05, 0.0 = disabled)
(env: LLAMA_ARG_MIN_P)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-nsigma | --top-n-sigma )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-n-sigma sampling (default: -1.00, -1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --xtc-probability )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
xtc probability (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --xtc-threshold )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
xtc threshold (default: 0.10, 1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --typical | --typical-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
locally typical sampling, parameter p (default: 1.00, 1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repeat-last-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
last n tokens to consider for penalize (default: 64, 0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repeat-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
penalize repeat sequence of tokens (default: 1.00, 1.0 = disabled)
(env: LLAMA_ARG_REPEAT_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --presence-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
repeat alpha presence penalty (default: 0.00, 0.0 = disabled)
(env: LLAMA_ARG_PRESENCE_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --frequency-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
repeat alpha frequency penalty (default: 0.00, 0.0 = disabled)
(env: LLAMA_ARG_FREQUENCY_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-multiplier )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY sampling multiplier (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-base )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY sampling base value (default: 1.75)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-allowed-length )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set allowed length for DRY sampling (default: 2)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-penalty-last-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY penalty for the last n tokens (default: 64, 0 = disable)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-sequence-breaker )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add sequence breaker for DRY sampling, clearing out default breakers ('\\n', ':', '\"', '*') in the process; use \"none\" to not use any sequence breakers
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --adaptive-target )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
adaptive-p: select tokens near this probability (valid range 0.0 to 1.0; negative = disabled) (default: -1.00)
[(more info)](https://github.com/ggml-org/llama.cpp/pull/17927)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --adaptive-decay )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
adaptive-p: 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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dynatemp-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
dynamic temperature range (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dynatemp-exp )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
dynamic temperature exponent (default: 1.00)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use Mirostat sampling.
Top K, Nucleus and Locally Typical samplers are ignored if used.
(default: 0, 0 = disabled, 1 = Mirostat, 2 = Mirostat 2.0)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat-lr )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Mirostat learning rate, parameter eta (default: 0.10)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat-ent )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Mirostat target entropy, parameter tau (default: 5.00)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -l | --logit-bias )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
modifies the likelihood of token appearing in the completion,
i.e. \`--logit-bias 15043+1\` to increase likelihood of token ' Hello',
or \`--logit-bias 15043-1\` to decrease likelihood of token ' Hello'"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --grammar )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
BNF-like grammar to constrain generations (see samples in grammars/ dir)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --grammar-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
file to read grammar from"
            fi
            COMPREPLY=( $(compgen -f -X '!*.gbnf' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -j | --json-schema )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
JSON schema to constrain generations (https://json-schema.org/), e.g. \`{\"type\": \"object\"}\` for any JSON object"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -jf | --json-schema-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
File containing a JSON schema to constrain generations (https://json-schema.org/), e.g. \`{\"type\": \"object\"}\` for any JSON object"
            fi
            COMPREPLY=( $(compgen -f -X '!*.json' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -bs | --backend-sampling )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
enable backend sampling (experimental) (default: disabled)
(env: LLAMA_ARG_BACKEND_SAMPLING)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-n-max )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of tokens to draft for speculative decoding (default: 3)
(env: LLAMA_ARG_SPEC_DRAFT_N_MAX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-n-min )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
minimum number of draft tokens to use for speculative decoding (default: 0)
(env: LLAMA_ARG_SPEC_DRAFT_N_MIN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --draft | --draft-n | --draft-max )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
the argument has been removed. use --spec-draft-n-max or --spec-ngram-mod-n-max
(env: LLAMA_ARG_DRAFT_MAX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --draft-min | --draft-n-min )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
the argument has been removed. use --spec-draft-n-min or --spec-ngram-mod-n-min
(env: LLAMA_ARG_DRAFT_MIN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -co | --color )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
Colorize output to distinguish prompt and user input from generations ('on', 'off', or 'auto', default: 'auto')
'auto' enables colors when output is to a terminal"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        -lcs | --lookup-cache-static )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to static lookup cache to use for lookup decoding (not updated by generation)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -lcd | --lookup-cache-dynamic )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to dynamic lookup cache to use for lookup decoding (updated by generation)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
    esac

case "$curr" in
    -* )
        COMPREPLY=( $(compgen -W "${opts}" -- "$curr") )
        return 0
    ;;
esac
} && complete -F _comp_cmd_llama_lookup_stats llama-lookup-stats

_comp_cmd_llama_mtmd_cli()
{
    local curr prev opts
    COMPREPLY=()
    curr="${COMP_WORDS[COMP_CWORD]}"
    prev="${COMP_WORDS[COMP_CWORD-1]}"

    opts="
        -h --help --usage
        --version
        -cl --cache-list
        --completion-bash
        -t --threads
        -tb --threads-batch
        -C --cpu-mask
        -Cr --cpu-range
        --cpu-strict
        --prio
        --poll
        -Cb --cpu-mask-batch
        -Crb --cpu-range-batch
        --cpu-strict-batch
        --prio-batch
        --poll-batch
        -c --ctx-size
        -n --predict --n-predict
        -b --batch-size
        -ub --ubatch-size
        --keep
        --swa-full
        -fa --flash-attn
        -p --prompt
        --perf
        -f --file
        -bf --binary-file
        -e --escape
        --rope-scaling
        --rope-scale
        --rope-freq-base
        --rope-freq-scale
        --yarn-orig-ctx
        --yarn-ext-factor
        --yarn-attn-factor
        --yarn-beta-slow
        --yarn-beta-fast
        -kvo --kv-offload
        --repack
        --no-host
        -ctk --cache-type-k
        -ctv --cache-type-v
        -dt --defrag-thold
        -np --parallel
        --rpc
        -lm --load-mode
        -lzm --lazy-mode
        --numa
        -dev --device
        --list-devices
        -ot --override-tensor
        -cmoe --cpu-moe
        -ncmoe --n-cpu-moe
        --moe-cache-mib
        -ncffn --n-cpu-ffn
        -ngl --gpu-layers --n-gpu-layers
        -sm --split-mode
        -ts --tensor-split
        -mg --main-gpu
        -fit --fit
        -fitt --fit-target
        -fitc --fit-ctx
        --check-tensors
        --override-kv
        --op-offload
        --lora
        --lora-scaled
        --control-vector
        --control-vector-scaled
        --control-vector-layer-range
        -m --model
        -mu --model-url
        -dr --docker-repo
        -hf -hfr --hf-repo
        -hff --hf-file
        -hft --hf-token
        --log-disable
        --log-file
        --log-jsonl
        --log-colors
        -v --verbose --log-verbose
        --offline
        -lv --verbosity --log-verbosity
        --log-prefix
        --log-timestamps
        --spec-draft-type-k -ctkd --cache-type-k-draft
        --spec-draft-type-v -ctvd --cache-type-v-draft
        --samplers
        -s --seed
        --sampler-seq --sampling-seq
        --ignore-eos
        --temp --temperature
        --top-k
        --top-p
        --min-p
        --top-nsigma --top-n-sigma
        --xtc-probability
        --xtc-threshold
        --typical --typical-p
        --repeat-last-n
        --repeat-penalty
        --presence-penalty
        --frequency-penalty
        --dry-multiplier
        --dry-base
        --dry-allowed-length
        --dry-penalty-last-n
        --dry-sequence-breaker
        --adaptive-target
        --adaptive-decay
        --dynatemp-range
        --dynatemp-exp
        --mirostat
        --mirostat-lr
        --mirostat-ent
        -l --logit-bias
        --grammar
        --grammar-file
        -j --json-schema
        -jf --json-schema-file
        -bs --backend-sampling
        -sys --system-prompt
        --warmup
        -mm --mmproj
        -mmu --mmproj-url
        --mmproj-auto
        --mmproj-offload
        -mmdev --mmproj-device
        --image --audio --video
        --image-min-tokens
        --image-max-tokens
        --video-fps
        --video-timestamp-interval
        --video-ffmpeg-dir
        --jinja
        --chat-template
    "

    case "$prev" in
        -h | --help | --usage )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print usage and exit"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --version )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
show version and build info"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -cl | --cache-list )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
show list of models in cache"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --completion-bash )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print source-able bash completion script for llama.cpp"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -t | --threads )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of CPU threads to use during generation (default: -1)
(env: LLAMA_ARG_THREADS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -tb | --threads-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of threads to use during batch and prompt processing (default: same as --threads)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -C | --cpu-mask )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
CPU affinity mask: arbitrarily long hex. Complements cpu-range (default: \"\")"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Cr | --cpu-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
range of CPUs for affinity. Complements --cpu-mask"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --cpu-strict )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use strict CPU placement (default: 0)
"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --prio )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set process/thread priority : low(-1), normal(0), medium(1), high(2), realtime(3) (default: 0)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --poll )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use polling level to wait for work (0 - no polling, default: 50)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Cb | --cpu-mask-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
CPU affinity mask: arbitrarily long hex. Complements cpu-range-batch (default: same as --cpu-mask)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Crb | --cpu-range-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ranges of CPUs for affinity. Complements --cpu-mask-batch"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --cpu-strict-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use strict CPU placement (default: same as --cpu-strict)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --prio-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set process/thread priority : 0-normal, 1-medium, 2-high, 3-realtime (default: 0)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --poll-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use polling to wait for work (default: same as --poll)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        -c | --ctx-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
size of the prompt context (default: 0, 0 = loaded from model)
(env: LLAMA_ARG_CTX_SIZE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -n | --predict | --n-predict )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of tokens to predict (default: -1, -1 = infinity)
(env: LLAMA_ARG_N_PREDICT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -b | --batch-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
logical maximum batch size (default: 2048)
(env: LLAMA_ARG_BATCH)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ub | --ubatch-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
physical maximum batch size (default: 512)
(env: LLAMA_ARG_UBATCH)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --keep )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of tokens to keep from the initial prompt (default: 0, -1 = all)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --swa-full )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fa | --flash-attn )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
set Flash Attention use ('on', 'off', or 'auto', default: 'auto')
(env: LLAMA_ARG_FLASH_ATTN)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        -p | --prompt )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
prompt to start generation with; for system message, use -sys"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --perf )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable internal libllama performance timings (default: false)
(env: LLAMA_ARG_PERF)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -f | --file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
a file containing the prompt (default: none)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -bf | --binary-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
binary file containing the prompt (default: none)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -e | --escape )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to process escapes sequences (\\n, \\r, \\t, \\', \\\", \\\\) (default: true)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-scaling )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
RoPE frequency scaling method, defaults to linear unless specified by the model
(env: LLAMA_ARG_ROPE_SCALING_TYPE)"
            fi
            COMPREPLY=( $(compgen -W 'none linear yarn' -- "$cur") )
            return 0
        ;;
        --rope-scale )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE context scaling factor, expands context by a factor of N
(env: LLAMA_ARG_ROPE_SCALE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-freq-base )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE base frequency, used by NTK-aware scaling (default: loaded from model)
(env: LLAMA_ARG_ROPE_FREQ_BASE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-freq-scale )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE frequency scaling factor, expands context by a factor of 1/N
(env: LLAMA_ARG_ROPE_FREQ_SCALE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-orig-ctx )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: original context size of model (default: 0 = model training context size)
(env: LLAMA_ARG_YARN_ORIG_CTX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-ext-factor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: extrapolation mix factor (default: -1.00, 0.0 = full interpolation)
(env: LLAMA_ARG_YARN_EXT_FACTOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-attn-factor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: scale sqrt(t) or attention magnitude (default: -1.00)
(env: LLAMA_ARG_YARN_ATTN_FACTOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-beta-slow )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: high correction dim or alpha (default: -1.00)
(env: LLAMA_ARG_YARN_BETA_SLOW)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-beta-fast )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: low correction dim or beta (default: -1.00)
(env: LLAMA_ARG_YARN_BETA_FAST)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -kvo | --kv-offload )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable KV cache offloading (default: enabled)
(env: LLAMA_ARG_KV_OFFLOAD)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repack )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable weight repacking (default: enabled)
(env: LLAMA_ARG_REPACK)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --no-host )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
bypass host buffer allowing extra buffers to be used
(env: LLAMA_ARG_NO_HOST)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ctk | --cache-type-k )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ctv | --cache-type-v )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -dt | --defrag-thold )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
KV cache defragmentation threshold (DEPRECATED)
(env: LLAMA_ARG_DEFRAG_THOLD)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -np | --parallel )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of parallel sequences to decode (default: 1)
(env: LLAMA_ARG_N_PARALLEL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rpc )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
comma-separated list of RPC servers (host:port)
(env: LLAMA_ARG_RPC)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -lm | --load-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
model loading mode (default: auto)
- 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)"
            fi
            COMPREPLY=( $(compgen -W 'auto none mmap mlock mmap+mlock dio' -- "$cur") )
            return 0
        ;;
        -lzm | --lazy-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
on-demand reading of certain tensors, for example per-layer embeddings (default: auto)
- on: read the rows of such tensors from disk on demand instead of keeping them resident (requires mmap)
- auto: on, but only for tensors larger than 4 GiB
- off: always keep them resident
(env: LLAMA_ARG_LAZY_MODE)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        --numa )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
attempt optimizations that help on some NUMA systems
- 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)"
            fi
            COMPREPLY=( $(compgen -W 'distribute isolate numactl' -- "$cur") )
            return 0
        ;;
        -dev | --device )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --list-devices )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print list of available devices and exit"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ot | --override-tensor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
override tensor buffer type
(env: LLAMA_ARG_OVERRIDE_TENSOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -cmoe | --cpu-moe )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep all Mixture of Experts (MoE) weights in the CPU
(env: LLAMA_ARG_CPU_MOE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ncmoe | --n-cpu-moe )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep the Mixture of Experts (MoE) weights of the first N layers in the CPU
(env: LLAMA_ARG_N_CPU_MOE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --moe-cache-mib )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
GPU cache size in MiB for the MoE experts kept in the CPU. with multiple GPUs, it is split among them like the layers (--tensor-split) (default: 0, disabled)
(env: LLAMA_ARG_MOE_CACHE_MIB)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ncffn | --n-cpu-ffn )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep the dense FFN weights of the first N layers in the CPU
(dense models; for MoE expert weights use --n-cpu-moe)
(env: LLAMA_ARG_N_CPU_FFN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ngl | --gpu-layers | --n-gpu-layers )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
max. number of layers to store in VRAM, either an exact number, 'auto', or 'all' (default: auto)
(env: LLAMA_ARG_N_GPU_LAYERS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -sm | --split-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
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)"
            fi
            COMPREPLY=( $(compgen -W 'none layer row split' -- "$cur") )
            return 0
        ;;
        -ts | --tensor-split )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
fraction of the model to offload to each GPU, comma-separated list of proportions, e.g. 3,1
(env: LLAMA_ARG_TENSOR_SPLIT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -mg | --main-gpu )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fit | --fit )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
whether to adjust unset arguments to fit in device memory ('on' or 'off', default: 'on')
(env: LLAMA_ARG_FIT)"
            fi
            COMPREPLY=( $(compgen -W 'on off' -- "$cur") )
            return 0
        ;;
        -fitt | --fit-target )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fitc | --fit-ctx )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
minimum ctx size that can be set by --fit option, default: 4096
(env: LLAMA_ARG_FIT_CTX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --check-tensors )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
check model tensor data for invalid values (default: false)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --override-kv )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --op-offload )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to offload host tensor operations to device (default: true)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --lora )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to LoRA adapter (use comma-separated values to load multiple adapters)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --lora-scaled )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to LoRA adapter with user defined scaling (format: FNAME:SCALE,...)
note: use comma-separated values"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add a control vector
note: use comma-separated values to add multiple control vectors"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector-scaled )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add a control vector with user defined scaling SCALE
note: use comma-separated values (format: FNAME:SCALE,...)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector-layer-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
layer range to apply the control vector(s) to, start and end inclusive"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -m | --model )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
model path to load
(env: LLAMA_ARG_MODEL)"
            fi
            COMPREPLY=( $(compgen -f -X '!*.gguf' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -mu | --model-url )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
model download url (default: unused)
(env: LLAMA_ARG_MODEL_URL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -dr | --docker-repo )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Docker Hub model repository. repo is optional, default to ai/. quant is optional, default to :latest.
example: gemma3
(default: unused)
(env: LLAMA_ARG_DOCKER_REPO)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hf | -hfr | --hf-repo )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face model repository; quant is optional, case-insensitive, default to Q4_K_M, or falls back to the first file in the repo if Q4_K_M doesn't exist.
mmproj is also downloaded automatically if available. to disable, add --no-mmproj
example: ggml-org/GLM-4.7-Flash-GGUF:Q4_K_M
(default: unused)
(env: LLAMA_ARG_HF_REPO)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hff | --hf-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face model file. If specified, it will override the quant in --hf-repo (default: unused)
(env: LLAMA_ARG_HF_FILE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hft | --hf-token )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face access token (default: value from HF_TOKEN environment variable)
(env: HF_TOKEN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-disable )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log disable"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log to file
(env: LLAMA_ARG_LOG_FILE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-jsonl )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log as JSONL (one JSON object per line) to stdout, this also disables colored logging (default: disabled)
(env: LLAMA_ARG_LOG_JSONL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-colors )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
Set colored logging ('on', 'off', or 'auto', default: 'auto')
'auto' enables colors when output is to a terminal
(env: LLAMA_ARG_LOG_COLORS)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        -v | --verbose | --log-verbose )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Set verbosity level to infinity (i.e. log all messages, useful for debugging)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --offline )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Offline mode: forces use of cache, prevents network access
(env: LLAMA_ARG_OFFLINE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -lv | --verbosity | --log-verbosity )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Set the verbosity threshold. Messages with a higher verbosity will be ignored. Values:
 - 0: generic output
 - 1: error
 - 2: warning
 - 3: info
 - 4: trace (more info)
 - 5: debug
(default: 3)

(env: LLAMA_ARG_LOG_VERBOSITY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-prefix )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Enable prefix in log messages
(env: LLAMA_ARG_LOG_PREFIX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-timestamps )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Enable timestamps in log messages
(env: LLAMA_ARG_LOG_TIMESTAMPS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-type-k | -ctkd | --cache-type-k-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-type-v | -ctvd | --cache-type-v-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
KV cache data type for V 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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --samplers )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
samplers that will be used for generation in the order, separated by ';'
(default: penalties;dry;top_n_sigma;top_k;typ_p;top_p;min_p;xtc;temperature)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -s | --seed )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RNG seed (default: -1, use random seed for -1)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --sampler-seq | --sampling-seq )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
simplified sequence for samplers that will be used (default: edskypmxt)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --ignore-eos )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ignore end of stream token and continue generating (implies --logit-bias EOS-inf)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --temp | --temperature )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
temperature (default: 0.20)
(env: LLAMA_ARG_TEMPERATURE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-k )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-k sampling (default: 40, 0 = disabled)
(env: LLAMA_ARG_TOP_K)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-p sampling (default: 0.95, 1.0 = disabled)
(env: LLAMA_ARG_TOP_P)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --min-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
min-p sampling (default: 0.05, 0.0 = disabled)
(env: LLAMA_ARG_MIN_P)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-nsigma | --top-n-sigma )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-n-sigma sampling (default: -1.00, -1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --xtc-probability )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
xtc probability (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --xtc-threshold )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
xtc threshold (default: 0.10, 1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --typical | --typical-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
locally typical sampling, parameter p (default: 1.00, 1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repeat-last-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
last n tokens to consider for penalize (default: 64, 0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repeat-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
penalize repeat sequence of tokens (default: 1.00, 1.0 = disabled)
(env: LLAMA_ARG_REPEAT_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --presence-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
repeat alpha presence penalty (default: 0.00, 0.0 = disabled)
(env: LLAMA_ARG_PRESENCE_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --frequency-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
repeat alpha frequency penalty (default: 0.00, 0.0 = disabled)
(env: LLAMA_ARG_FREQUENCY_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-multiplier )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY sampling multiplier (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-base )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY sampling base value (default: 1.75)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-allowed-length )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set allowed length for DRY sampling (default: 2)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-penalty-last-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY penalty for the last n tokens (default: 64, 0 = disable)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-sequence-breaker )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add sequence breaker for DRY sampling, clearing out default breakers ('\\n', ':', '\"', '*') in the process; use \"none\" to not use any sequence breakers
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --adaptive-target )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
adaptive-p: select tokens near this probability (valid range 0.0 to 1.0; negative = disabled) (default: -1.00)
[(more info)](https://github.com/ggml-org/llama.cpp/pull/17927)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --adaptive-decay )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
adaptive-p: 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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dynatemp-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
dynamic temperature range (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dynatemp-exp )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
dynamic temperature exponent (default: 1.00)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use Mirostat sampling.
Top K, Nucleus and Locally Typical samplers are ignored if used.
(default: 0, 0 = disabled, 1 = Mirostat, 2 = Mirostat 2.0)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat-lr )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Mirostat learning rate, parameter eta (default: 0.10)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat-ent )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Mirostat target entropy, parameter tau (default: 5.00)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -l | --logit-bias )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
modifies the likelihood of token appearing in the completion,
i.e. \`--logit-bias 15043+1\` to increase likelihood of token ' Hello',
or \`--logit-bias 15043-1\` to decrease likelihood of token ' Hello'"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --grammar )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
BNF-like grammar to constrain generations (see samples in grammars/ dir)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --grammar-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
file to read grammar from"
            fi
            COMPREPLY=( $(compgen -f -X '!*.gbnf' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -j | --json-schema )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
JSON schema to constrain generations (https://json-schema.org/), e.g. \`{\"type\": \"object\"}\` for any JSON object"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -jf | --json-schema-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
File containing a JSON schema to constrain generations (https://json-schema.org/), e.g. \`{\"type\": \"object\"}\` for any JSON object"
            fi
            COMPREPLY=( $(compgen -f -X '!*.json' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -bs | --backend-sampling )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
enable backend sampling (experimental) (default: disabled)
(env: LLAMA_ARG_BACKEND_SAMPLING)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -sys | --system-prompt )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
system prompt to use with model (if applicable, depending on chat template)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --warmup )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to perform warmup with an empty run (default: enabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -mm | --mmproj )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
path to a multimodal projector file. see tools/mtmd/README.md
note: if -hf is used, this argument can be omitted
(env: LLAMA_ARG_MMPROJ)"
            fi
            COMPREPLY=( $(compgen -f -X '!*.mmproj' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -mmu | --mmproj-url )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
URL to a multimodal projector file. see tools/mtmd/README.md
(env: LLAMA_ARG_MMPROJ_URL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mmproj-auto )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to use multimodal projector file (if available), useful when using -hf (default: enabled)
(env: LLAMA_ARG_MMPROJ_AUTO)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mmproj-offload )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable GPU offloading for multimodal projector (default: enabled)
(env: LLAMA_ARG_MMPROJ_OFFLOAD)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -mmdev | --mmproj-device )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
device to use for multimodal projector (none = don't offload, default: follows --device)
use --list-devices to see a list of available devices
(env: MTMD_BACKEND_DEVICE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --image | --audio | --video )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to an image, audio, or video file. use with multimodal models, use comma-separated values for multiple files
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --image-min-tokens )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
minimum number of tokens each image can take, only used by vision models with dynamic resolution (default: read from model)
(env: LLAMA_ARG_IMAGE_MIN_TOKENS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --image-max-tokens )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
maximum number of tokens each image can take, only used by vision models with dynamic resolution (default: read from model)
(env: LLAMA_ARG_IMAGE_MAX_TOKENS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --video-fps )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
target video frame rate (default: 4.0)
(env: LLAMA_ARG_VIDEO_FPS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --video-timestamp-interval )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
interval in milliseconds between text timestamps (default: 5000)
(env: LLAMA_ARG_VIDEO_TIMESTAMP_INTERVAL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --video-ffmpeg-dir )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to the directory containing ffmpeg and ffprobe (default: search in PATH)
(env: LLAMA_ARG_VIDEO_FFMPEG_DIR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --jinja )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to use jinja template engine for chat (default: disabled)
(env: LLAMA_ARG_JINJA)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --chat-template )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set custom jinja chat template (default: template taken from model's metadata)
if suffix/prefix are specified, template will be disabled
only commonly used templates are accepted (unless --jinja is set before this flag):
list of built-in templates:
bailing, bailing-think, bailing2, chatglm3, chatglm4, chatml, command-r, deepseek, deepseek-ocr, deepseek2, deepseek3, exaone-moe, exaone3, exaone4, falcon3, gemma, gigachat, glmedge, gpt-oss, granite, granite-4.0, granite-4.1, grok-2, hunyuan-dense, hunyuan-moe, hunyuan-vl, kimi-k2, llama2, llama2-sys, llama2-sys-bos, llama2-sys-strip, llama3, llama4, megrez, minicpm, mistral-v1, mistral-v3, mistral-v3-tekken, mistral-v7, mistral-v7-tekken, monarch, openchat, orion, pangu-embedded, phi3, phi4, rwkv-world, seed_oss, smolvlm, solar-open, vicuna, vicuna-orca, yandex, zephyr
(env: LLAMA_ARG_CHAT_TEMPLATE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
    esac

case "$curr" in
    -* )
        COMPREPLY=( $(compgen -W "${opts}" -- "$curr") )
        return 0
    ;;
esac
} && complete -F _comp_cmd_llama_mtmd_cli llama-mtmd-cli

_comp_cmd_llama_parallel()
{
    local curr prev opts
    COMPREPLY=()
    curr="${COMP_WORDS[COMP_CWORD]}"
    prev="${COMP_WORDS[COMP_CWORD-1]}"

    opts="
        -h --help --usage
        --version
        -cl --cache-list
        --completion-bash
        -t --threads
        -tb --threads-batch
        -C --cpu-mask
        -Cr --cpu-range
        --cpu-strict
        --prio
        --poll
        -Cb --cpu-mask-batch
        -Crb --cpu-range-batch
        --cpu-strict-batch
        --prio-batch
        --poll-batch
        -c --ctx-size
        -n --predict --n-predict
        -b --batch-size
        -ub --ubatch-size
        --keep
        --swa-full
        -fa --flash-attn
        -p --prompt
        --perf
        -f --file
        -bf --binary-file
        -e --escape
        --rope-scaling
        --rope-scale
        --rope-freq-base
        --rope-freq-scale
        --yarn-orig-ctx
        --yarn-ext-factor
        --yarn-attn-factor
        --yarn-beta-slow
        --yarn-beta-fast
        -kvo --kv-offload
        --repack
        --no-host
        -ctk --cache-type-k
        -ctv --cache-type-v
        -dt --defrag-thold
        -np --parallel
        --rpc
        -lm --load-mode
        -lzm --lazy-mode
        --numa
        -dev --device
        --list-devices
        -ot --override-tensor
        -cmoe --cpu-moe
        -ncmoe --n-cpu-moe
        --moe-cache-mib
        -ncffn --n-cpu-ffn
        -ngl --gpu-layers --n-gpu-layers
        -sm --split-mode
        -ts --tensor-split
        -mg --main-gpu
        -fit --fit
        -fitt --fit-target
        -fitc --fit-ctx
        --check-tensors
        --override-kv
        --op-offload
        --lora
        --lora-scaled
        --control-vector
        --control-vector-scaled
        --control-vector-layer-range
        -m --model
        -mu --model-url
        -dr --docker-repo
        -hf -hfr --hf-repo
        -hff --hf-file
        -hft --hf-token
        --log-disable
        --log-file
        --log-jsonl
        --log-colors
        -v --verbose --log-verbose
        --offline
        -lv --verbosity --log-verbosity
        --log-prefix
        --log-timestamps
        --spec-draft-type-k -ctkd --cache-type-k-draft
        --spec-draft-type-v -ctvd --cache-type-v-draft
        --samplers
        -s --seed
        --sampler-seq --sampling-seq
        --ignore-eos
        --temp --temperature
        --top-k
        --top-p
        --min-p
        --top-nsigma --top-n-sigma
        --xtc-probability
        --xtc-threshold
        --typical --typical-p
        --repeat-last-n
        --repeat-penalty
        --presence-penalty
        --frequency-penalty
        --dry-multiplier
        --dry-base
        --dry-allowed-length
        --dry-penalty-last-n
        --dry-sequence-breaker
        --adaptive-target
        --adaptive-decay
        --dynatemp-range
        --dynatemp-exp
        --mirostat
        --mirostat-lr
        --mirostat-ent
        -l --logit-bias
        --grammar
        --grammar-file
        -j --json-schema
        -jf --json-schema-file
        -bs --backend-sampling
        -kvu --kv-unified
        -ns --sequences
        --junk
        -pps
        -tgs
    "

    case "$prev" in
        -h | --help | --usage )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print usage and exit"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --version )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
show version and build info"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -cl | --cache-list )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
show list of models in cache"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --completion-bash )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print source-able bash completion script for llama.cpp"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -t | --threads )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of CPU threads to use during generation (default: -1)
(env: LLAMA_ARG_THREADS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -tb | --threads-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of threads to use during batch and prompt processing (default: same as --threads)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -C | --cpu-mask )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
CPU affinity mask: arbitrarily long hex. Complements cpu-range (default: \"\")"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Cr | --cpu-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
range of CPUs for affinity. Complements --cpu-mask"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --cpu-strict )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use strict CPU placement (default: 0)
"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --prio )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set process/thread priority : low(-1), normal(0), medium(1), high(2), realtime(3) (default: 0)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --poll )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use polling level to wait for work (0 - no polling, default: 50)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Cb | --cpu-mask-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
CPU affinity mask: arbitrarily long hex. Complements cpu-range-batch (default: same as --cpu-mask)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Crb | --cpu-range-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ranges of CPUs for affinity. Complements --cpu-mask-batch"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --cpu-strict-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use strict CPU placement (default: same as --cpu-strict)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --prio-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set process/thread priority : 0-normal, 1-medium, 2-high, 3-realtime (default: 0)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --poll-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use polling to wait for work (default: same as --poll)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        -c | --ctx-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
size of the prompt context (default: 0, 0 = loaded from model)
(env: LLAMA_ARG_CTX_SIZE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -n | --predict | --n-predict )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of tokens to predict (default: 128, -1 = infinity)
(env: LLAMA_ARG_N_PREDICT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -b | --batch-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
logical maximum batch size (default: 2048)
(env: LLAMA_ARG_BATCH)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ub | --ubatch-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
physical maximum batch size (default: 512)
(env: LLAMA_ARG_UBATCH)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --keep )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of tokens to keep from the initial prompt (default: 0, -1 = all)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --swa-full )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fa | --flash-attn )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
set Flash Attention use ('on', 'off', or 'auto', default: 'auto')
(env: LLAMA_ARG_FLASH_ATTN)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        -p | --prompt )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
prompt to start generation with; for system message, use -sys"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --perf )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable internal libllama performance timings (default: false)
(env: LLAMA_ARG_PERF)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -f | --file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
a file containing the prompt (default: none)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -bf | --binary-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
binary file containing the prompt (default: none)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -e | --escape )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to process escapes sequences (\\n, \\r, \\t, \\', \\\", \\\\) (default: true)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-scaling )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
RoPE frequency scaling method, defaults to linear unless specified by the model
(env: LLAMA_ARG_ROPE_SCALING_TYPE)"
            fi
            COMPREPLY=( $(compgen -W 'none linear yarn' -- "$cur") )
            return 0
        ;;
        --rope-scale )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE context scaling factor, expands context by a factor of N
(env: LLAMA_ARG_ROPE_SCALE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-freq-base )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE base frequency, used by NTK-aware scaling (default: loaded from model)
(env: LLAMA_ARG_ROPE_FREQ_BASE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-freq-scale )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE frequency scaling factor, expands context by a factor of 1/N
(env: LLAMA_ARG_ROPE_FREQ_SCALE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-orig-ctx )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: original context size of model (default: 0 = model training context size)
(env: LLAMA_ARG_YARN_ORIG_CTX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-ext-factor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: extrapolation mix factor (default: -1.00, 0.0 = full interpolation)
(env: LLAMA_ARG_YARN_EXT_FACTOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-attn-factor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: scale sqrt(t) or attention magnitude (default: -1.00)
(env: LLAMA_ARG_YARN_ATTN_FACTOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-beta-slow )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: high correction dim or alpha (default: -1.00)
(env: LLAMA_ARG_YARN_BETA_SLOW)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-beta-fast )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: low correction dim or beta (default: -1.00)
(env: LLAMA_ARG_YARN_BETA_FAST)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -kvo | --kv-offload )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable KV cache offloading (default: enabled)
(env: LLAMA_ARG_KV_OFFLOAD)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repack )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable weight repacking (default: enabled)
(env: LLAMA_ARG_REPACK)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --no-host )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
bypass host buffer allowing extra buffers to be used
(env: LLAMA_ARG_NO_HOST)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ctk | --cache-type-k )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ctv | --cache-type-v )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -dt | --defrag-thold )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
KV cache defragmentation threshold (DEPRECATED)
(env: LLAMA_ARG_DEFRAG_THOLD)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -np | --parallel )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of parallel sequences to decode (default: 1)
(env: LLAMA_ARG_N_PARALLEL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rpc )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
comma-separated list of RPC servers (host:port)
(env: LLAMA_ARG_RPC)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -lm | --load-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
model loading mode (default: auto)
- 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)"
            fi
            COMPREPLY=( $(compgen -W 'auto none mmap mlock mmap+mlock dio' -- "$cur") )
            return 0
        ;;
        -lzm | --lazy-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
on-demand reading of certain tensors, for example per-layer embeddings (default: auto)
- on: read the rows of such tensors from disk on demand instead of keeping them resident (requires mmap)
- auto: on, but only for tensors larger than 4 GiB
- off: always keep them resident
(env: LLAMA_ARG_LAZY_MODE)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        --numa )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
attempt optimizations that help on some NUMA systems
- 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)"
            fi
            COMPREPLY=( $(compgen -W 'distribute isolate numactl' -- "$cur") )
            return 0
        ;;
        -dev | --device )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --list-devices )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print list of available devices and exit"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ot | --override-tensor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
override tensor buffer type
(env: LLAMA_ARG_OVERRIDE_TENSOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -cmoe | --cpu-moe )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep all Mixture of Experts (MoE) weights in the CPU
(env: LLAMA_ARG_CPU_MOE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ncmoe | --n-cpu-moe )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep the Mixture of Experts (MoE) weights of the first N layers in the CPU
(env: LLAMA_ARG_N_CPU_MOE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --moe-cache-mib )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
GPU cache size in MiB for the MoE experts kept in the CPU. with multiple GPUs, it is split among them like the layers (--tensor-split) (default: 0, disabled)
(env: LLAMA_ARG_MOE_CACHE_MIB)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ncffn | --n-cpu-ffn )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep the dense FFN weights of the first N layers in the CPU
(dense models; for MoE expert weights use --n-cpu-moe)
(env: LLAMA_ARG_N_CPU_FFN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ngl | --gpu-layers | --n-gpu-layers )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
max. number of layers to store in VRAM, either an exact number, 'auto', or 'all' (default: auto)
(env: LLAMA_ARG_N_GPU_LAYERS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -sm | --split-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
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)"
            fi
            COMPREPLY=( $(compgen -W 'none layer row split' -- "$cur") )
            return 0
        ;;
        -ts | --tensor-split )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
fraction of the model to offload to each GPU, comma-separated list of proportions, e.g. 3,1
(env: LLAMA_ARG_TENSOR_SPLIT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -mg | --main-gpu )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fit | --fit )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
whether to adjust unset arguments to fit in device memory ('on' or 'off', default: 'on')
(env: LLAMA_ARG_FIT)"
            fi
            COMPREPLY=( $(compgen -W 'on off' -- "$cur") )
            return 0
        ;;
        -fitt | --fit-target )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fitc | --fit-ctx )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
minimum ctx size that can be set by --fit option, default: 4096
(env: LLAMA_ARG_FIT_CTX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --check-tensors )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
check model tensor data for invalid values (default: false)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --override-kv )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --op-offload )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to offload host tensor operations to device (default: true)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --lora )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to LoRA adapter (use comma-separated values to load multiple adapters)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --lora-scaled )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to LoRA adapter with user defined scaling (format: FNAME:SCALE,...)
note: use comma-separated values"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add a control vector
note: use comma-separated values to add multiple control vectors"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector-scaled )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add a control vector with user defined scaling SCALE
note: use comma-separated values (format: FNAME:SCALE,...)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector-layer-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
layer range to apply the control vector(s) to, start and end inclusive"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -m | --model )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
model path to load
(env: LLAMA_ARG_MODEL)"
            fi
            COMPREPLY=( $(compgen -f -X '!*.gguf' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -mu | --model-url )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
model download url (default: unused)
(env: LLAMA_ARG_MODEL_URL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -dr | --docker-repo )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Docker Hub model repository. repo is optional, default to ai/. quant is optional, default to :latest.
example: gemma3
(default: unused)
(env: LLAMA_ARG_DOCKER_REPO)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hf | -hfr | --hf-repo )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face model repository; quant is optional, case-insensitive, default to Q4_K_M, or falls back to the first file in the repo if Q4_K_M doesn't exist.
mmproj is also downloaded automatically if available. to disable, add --no-mmproj
example: ggml-org/GLM-4.7-Flash-GGUF:Q4_K_M
(default: unused)
(env: LLAMA_ARG_HF_REPO)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hff | --hf-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face model file. If specified, it will override the quant in --hf-repo (default: unused)
(env: LLAMA_ARG_HF_FILE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hft | --hf-token )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face access token (default: value from HF_TOKEN environment variable)
(env: HF_TOKEN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-disable )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log disable"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log to file
(env: LLAMA_ARG_LOG_FILE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-jsonl )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log as JSONL (one JSON object per line) to stdout, this also disables colored logging (default: disabled)
(env: LLAMA_ARG_LOG_JSONL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-colors )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
Set colored logging ('on', 'off', or 'auto', default: 'auto')
'auto' enables colors when output is to a terminal
(env: LLAMA_ARG_LOG_COLORS)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        -v | --verbose | --log-verbose )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Set verbosity level to infinity (i.e. log all messages, useful for debugging)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --offline )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Offline mode: forces use of cache, prevents network access
(env: LLAMA_ARG_OFFLINE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -lv | --verbosity | --log-verbosity )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Set the verbosity threshold. Messages with a higher verbosity will be ignored. Values:
 - 0: generic output
 - 1: error
 - 2: warning
 - 3: info
 - 4: trace (more info)
 - 5: debug
(default: 3)

(env: LLAMA_ARG_LOG_VERBOSITY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-prefix )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Enable prefix in log messages
(env: LLAMA_ARG_LOG_PREFIX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-timestamps )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Enable timestamps in log messages
(env: LLAMA_ARG_LOG_TIMESTAMPS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-type-k | -ctkd | --cache-type-k-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-type-v | -ctvd | --cache-type-v-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
KV cache data type for V 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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --samplers )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
samplers that will be used for generation in the order, separated by ';'
(default: penalties;dry;top_n_sigma;top_k;typ_p;top_p;min_p;xtc;temperature)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -s | --seed )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RNG seed (default: -1, use random seed for -1)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --sampler-seq | --sampling-seq )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
simplified sequence for samplers that will be used (default: edskypmxt)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --ignore-eos )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ignore end of stream token and continue generating (implies --logit-bias EOS-inf)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --temp | --temperature )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
temperature (default: 0.80)
(env: LLAMA_ARG_TEMPERATURE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-k )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-k sampling (default: 40, 0 = disabled)
(env: LLAMA_ARG_TOP_K)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-p sampling (default: 0.95, 1.0 = disabled)
(env: LLAMA_ARG_TOP_P)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --min-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
min-p sampling (default: 0.05, 0.0 = disabled)
(env: LLAMA_ARG_MIN_P)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-nsigma | --top-n-sigma )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-n-sigma sampling (default: -1.00, -1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --xtc-probability )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
xtc probability (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --xtc-threshold )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
xtc threshold (default: 0.10, 1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --typical | --typical-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
locally typical sampling, parameter p (default: 1.00, 1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repeat-last-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
last n tokens to consider for penalize (default: 64, 0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repeat-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
penalize repeat sequence of tokens (default: 1.00, 1.0 = disabled)
(env: LLAMA_ARG_REPEAT_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --presence-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
repeat alpha presence penalty (default: 0.00, 0.0 = disabled)
(env: LLAMA_ARG_PRESENCE_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --frequency-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
repeat alpha frequency penalty (default: 0.00, 0.0 = disabled)
(env: LLAMA_ARG_FREQUENCY_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-multiplier )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY sampling multiplier (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-base )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY sampling base value (default: 1.75)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-allowed-length )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set allowed length for DRY sampling (default: 2)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-penalty-last-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY penalty for the last n tokens (default: 64, 0 = disable)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-sequence-breaker )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add sequence breaker for DRY sampling, clearing out default breakers ('\\n', ':', '\"', '*') in the process; use \"none\" to not use any sequence breakers
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --adaptive-target )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
adaptive-p: select tokens near this probability (valid range 0.0 to 1.0; negative = disabled) (default: -1.00)
[(more info)](https://github.com/ggml-org/llama.cpp/pull/17927)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --adaptive-decay )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
adaptive-p: 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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dynatemp-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
dynamic temperature range (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dynatemp-exp )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
dynamic temperature exponent (default: 1.00)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use Mirostat sampling.
Top K, Nucleus and Locally Typical samplers are ignored if used.
(default: 0, 0 = disabled, 1 = Mirostat, 2 = Mirostat 2.0)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat-lr )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Mirostat learning rate, parameter eta (default: 0.10)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat-ent )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Mirostat target entropy, parameter tau (default: 5.00)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -l | --logit-bias )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
modifies the likelihood of token appearing in the completion,
i.e. \`--logit-bias 15043+1\` to increase likelihood of token ' Hello',
or \`--logit-bias 15043-1\` to decrease likelihood of token ' Hello'"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --grammar )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
BNF-like grammar to constrain generations (see samples in grammars/ dir)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --grammar-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
file to read grammar from"
            fi
            COMPREPLY=( $(compgen -f -X '!*.gbnf' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -j | --json-schema )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
JSON schema to constrain generations (https://json-schema.org/), e.g. \`{\"type\": \"object\"}\` for any JSON object"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -jf | --json-schema-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
File containing a JSON schema to constrain generations (https://json-schema.org/), e.g. \`{\"type\": \"object\"}\` for any JSON object"
            fi
            COMPREPLY=( $(compgen -f -X '!*.json' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -bs | --backend-sampling )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
enable backend sampling (experimental) (default: disabled)
(env: LLAMA_ARG_BACKEND_SAMPLING)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -kvu | --kv-unified )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use single unified KV buffer shared across all sequences (default: enabled if number of slots is auto)
(env: LLAMA_ARG_KV_UNIFIED)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ns | --sequences )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of sequences to decode (default: 1)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --junk )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of times to repeat the junk text (default: 1)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -pps )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
is the prompt shared across parallel sequences (default: false)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -tgs )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
is the text generation separated across the different sequences (default: false)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
    esac

case "$curr" in
    -* )
        COMPREPLY=( $(compgen -W "${opts}" -- "$curr") )
        return 0
    ;;
esac
} && complete -F _comp_cmd_llama_parallel llama-parallel

_comp_cmd_llama_passkey()
{
    local curr prev opts
    COMPREPLY=()
    curr="${COMP_WORDS[COMP_CWORD]}"
    prev="${COMP_WORDS[COMP_CWORD-1]}"

    opts="
        -h --help --usage
        --version
        -cl --cache-list
        --completion-bash
        -t --threads
        -tb --threads-batch
        -C --cpu-mask
        -Cr --cpu-range
        --cpu-strict
        --prio
        --poll
        -Cb --cpu-mask-batch
        -Crb --cpu-range-batch
        --cpu-strict-batch
        --prio-batch
        --poll-batch
        -c --ctx-size
        -n --predict --n-predict
        -b --batch-size
        -ub --ubatch-size
        --keep
        --swa-full
        -fa --flash-attn
        -p --prompt
        --perf
        -f --file
        -bf --binary-file
        -e --escape
        --rope-scaling
        --rope-scale
        --rope-freq-base
        --rope-freq-scale
        --yarn-orig-ctx
        --yarn-ext-factor
        --yarn-attn-factor
        --yarn-beta-slow
        --yarn-beta-fast
        -kvo --kv-offload
        --repack
        --no-host
        -ctk --cache-type-k
        -ctv --cache-type-v
        -dt --defrag-thold
        -np --parallel
        --rpc
        -lm --load-mode
        -lzm --lazy-mode
        --numa
        -dev --device
        --list-devices
        -ot --override-tensor
        -cmoe --cpu-moe
        -ncmoe --n-cpu-moe
        --moe-cache-mib
        -ncffn --n-cpu-ffn
        -ngl --gpu-layers --n-gpu-layers
        -sm --split-mode
        -ts --tensor-split
        -mg --main-gpu
        -fit --fit
        -fitt --fit-target
        -fitc --fit-ctx
        --check-tensors
        --override-kv
        --op-offload
        --lora
        --lora-scaled
        --control-vector
        --control-vector-scaled
        --control-vector-layer-range
        -m --model
        -mu --model-url
        -dr --docker-repo
        -hf -hfr --hf-repo
        -hff --hf-file
        -hft --hf-token
        --log-disable
        --log-file
        --log-jsonl
        --log-colors
        -v --verbose --log-verbose
        --offline
        -lv --verbosity --log-verbosity
        --log-prefix
        --log-timestamps
        --spec-draft-type-k -ctkd --cache-type-k-draft
        --spec-draft-type-v -ctvd --cache-type-v-draft
        --samplers
        -s --seed
        --sampler-seq --sampling-seq
        --ignore-eos
        --temp --temperature
        --top-k
        --top-p
        --min-p
        --top-nsigma --top-n-sigma
        --xtc-probability
        --xtc-threshold
        --typical --typical-p
        --repeat-last-n
        --repeat-penalty
        --presence-penalty
        --frequency-penalty
        --dry-multiplier
        --dry-base
        --dry-allowed-length
        --dry-penalty-last-n
        --dry-sequence-breaker
        --adaptive-target
        --adaptive-decay
        --dynatemp-range
        --dynatemp-exp
        --mirostat
        --mirostat-lr
        --mirostat-ent
        -l --logit-bias
        --grammar
        --grammar-file
        -j --json-schema
        -jf --json-schema-file
        -bs --backend-sampling
        -gan --grp-attn-n
        --junk
        --pos
    "

    case "$prev" in
        -h | --help | --usage )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print usage and exit"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --version )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
show version and build info"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -cl | --cache-list )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
show list of models in cache"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --completion-bash )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print source-able bash completion script for llama.cpp"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -t | --threads )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of CPU threads to use during generation (default: -1)
(env: LLAMA_ARG_THREADS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -tb | --threads-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of threads to use during batch and prompt processing (default: same as --threads)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -C | --cpu-mask )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
CPU affinity mask: arbitrarily long hex. Complements cpu-range (default: \"\")"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Cr | --cpu-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
range of CPUs for affinity. Complements --cpu-mask"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --cpu-strict )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use strict CPU placement (default: 0)
"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --prio )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set process/thread priority : low(-1), normal(0), medium(1), high(2), realtime(3) (default: 0)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --poll )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use polling level to wait for work (0 - no polling, default: 50)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Cb | --cpu-mask-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
CPU affinity mask: arbitrarily long hex. Complements cpu-range-batch (default: same as --cpu-mask)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Crb | --cpu-range-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ranges of CPUs for affinity. Complements --cpu-mask-batch"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --cpu-strict-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use strict CPU placement (default: same as --cpu-strict)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --prio-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set process/thread priority : 0-normal, 1-medium, 2-high, 3-realtime (default: 0)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --poll-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use polling to wait for work (default: same as --poll)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        -c | --ctx-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
size of the prompt context (default: 0, 0 = loaded from model)
(env: LLAMA_ARG_CTX_SIZE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -n | --predict | --n-predict )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of tokens to predict (default: -1, -1 = infinity)
(env: LLAMA_ARG_N_PREDICT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -b | --batch-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
logical maximum batch size (default: 2048)
(env: LLAMA_ARG_BATCH)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ub | --ubatch-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
physical maximum batch size (default: 512)
(env: LLAMA_ARG_UBATCH)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --keep )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of tokens to keep from the initial prompt (default: 32, -1 = all)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --swa-full )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fa | --flash-attn )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
set Flash Attention use ('on', 'off', or 'auto', default: 'auto')
(env: LLAMA_ARG_FLASH_ATTN)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        -p | --prompt )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
prompt to start generation with; for system message, use -sys"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --perf )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable internal libllama performance timings (default: false)
(env: LLAMA_ARG_PERF)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -f | --file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
a file containing the prompt (default: none)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -bf | --binary-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
binary file containing the prompt (default: none)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -e | --escape )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to process escapes sequences (\\n, \\r, \\t, \\', \\\", \\\\) (default: true)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-scaling )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
RoPE frequency scaling method, defaults to linear unless specified by the model
(env: LLAMA_ARG_ROPE_SCALING_TYPE)"
            fi
            COMPREPLY=( $(compgen -W 'none linear yarn' -- "$cur") )
            return 0
        ;;
        --rope-scale )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE context scaling factor, expands context by a factor of N
(env: LLAMA_ARG_ROPE_SCALE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-freq-base )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE base frequency, used by NTK-aware scaling (default: loaded from model)
(env: LLAMA_ARG_ROPE_FREQ_BASE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-freq-scale )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE frequency scaling factor, expands context by a factor of 1/N
(env: LLAMA_ARG_ROPE_FREQ_SCALE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-orig-ctx )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: original context size of model (default: 0 = model training context size)
(env: LLAMA_ARG_YARN_ORIG_CTX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-ext-factor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: extrapolation mix factor (default: -1.00, 0.0 = full interpolation)
(env: LLAMA_ARG_YARN_EXT_FACTOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-attn-factor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: scale sqrt(t) or attention magnitude (default: -1.00)
(env: LLAMA_ARG_YARN_ATTN_FACTOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-beta-slow )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: high correction dim or alpha (default: -1.00)
(env: LLAMA_ARG_YARN_BETA_SLOW)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-beta-fast )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: low correction dim or beta (default: -1.00)
(env: LLAMA_ARG_YARN_BETA_FAST)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -kvo | --kv-offload )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable KV cache offloading (default: enabled)
(env: LLAMA_ARG_KV_OFFLOAD)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repack )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable weight repacking (default: enabled)
(env: LLAMA_ARG_REPACK)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --no-host )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
bypass host buffer allowing extra buffers to be used
(env: LLAMA_ARG_NO_HOST)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ctk | --cache-type-k )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ctv | --cache-type-v )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -dt | --defrag-thold )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
KV cache defragmentation threshold (DEPRECATED)
(env: LLAMA_ARG_DEFRAG_THOLD)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -np | --parallel )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of parallel sequences to decode (default: 1)
(env: LLAMA_ARG_N_PARALLEL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rpc )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
comma-separated list of RPC servers (host:port)
(env: LLAMA_ARG_RPC)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -lm | --load-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
model loading mode (default: auto)
- 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)"
            fi
            COMPREPLY=( $(compgen -W 'auto none mmap mlock mmap+mlock dio' -- "$cur") )
            return 0
        ;;
        -lzm | --lazy-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
on-demand reading of certain tensors, for example per-layer embeddings (default: auto)
- on: read the rows of such tensors from disk on demand instead of keeping them resident (requires mmap)
- auto: on, but only for tensors larger than 4 GiB
- off: always keep them resident
(env: LLAMA_ARG_LAZY_MODE)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        --numa )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
attempt optimizations that help on some NUMA systems
- 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)"
            fi
            COMPREPLY=( $(compgen -W 'distribute isolate numactl' -- "$cur") )
            return 0
        ;;
        -dev | --device )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --list-devices )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print list of available devices and exit"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ot | --override-tensor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
override tensor buffer type
(env: LLAMA_ARG_OVERRIDE_TENSOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -cmoe | --cpu-moe )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep all Mixture of Experts (MoE) weights in the CPU
(env: LLAMA_ARG_CPU_MOE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ncmoe | --n-cpu-moe )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep the Mixture of Experts (MoE) weights of the first N layers in the CPU
(env: LLAMA_ARG_N_CPU_MOE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --moe-cache-mib )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
GPU cache size in MiB for the MoE experts kept in the CPU. with multiple GPUs, it is split among them like the layers (--tensor-split) (default: 0, disabled)
(env: LLAMA_ARG_MOE_CACHE_MIB)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ncffn | --n-cpu-ffn )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep the dense FFN weights of the first N layers in the CPU
(dense models; for MoE expert weights use --n-cpu-moe)
(env: LLAMA_ARG_N_CPU_FFN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ngl | --gpu-layers | --n-gpu-layers )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
max. number of layers to store in VRAM, either an exact number, 'auto', or 'all' (default: auto)
(env: LLAMA_ARG_N_GPU_LAYERS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -sm | --split-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
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)"
            fi
            COMPREPLY=( $(compgen -W 'none layer row split' -- "$cur") )
            return 0
        ;;
        -ts | --tensor-split )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
fraction of the model to offload to each GPU, comma-separated list of proportions, e.g. 3,1
(env: LLAMA_ARG_TENSOR_SPLIT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -mg | --main-gpu )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fit | --fit )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
whether to adjust unset arguments to fit in device memory ('on' or 'off', default: 'on')
(env: LLAMA_ARG_FIT)"
            fi
            COMPREPLY=( $(compgen -W 'on off' -- "$cur") )
            return 0
        ;;
        -fitt | --fit-target )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fitc | --fit-ctx )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
minimum ctx size that can be set by --fit option, default: 4096
(env: LLAMA_ARG_FIT_CTX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --check-tensors )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
check model tensor data for invalid values (default: false)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --override-kv )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --op-offload )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to offload host tensor operations to device (default: true)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --lora )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to LoRA adapter (use comma-separated values to load multiple adapters)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --lora-scaled )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to LoRA adapter with user defined scaling (format: FNAME:SCALE,...)
note: use comma-separated values"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add a control vector
note: use comma-separated values to add multiple control vectors"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector-scaled )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add a control vector with user defined scaling SCALE
note: use comma-separated values (format: FNAME:SCALE,...)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector-layer-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
layer range to apply the control vector(s) to, start and end inclusive"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -m | --model )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
model path to load
(env: LLAMA_ARG_MODEL)"
            fi
            COMPREPLY=( $(compgen -f -X '!*.gguf' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -mu | --model-url )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
model download url (default: unused)
(env: LLAMA_ARG_MODEL_URL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -dr | --docker-repo )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Docker Hub model repository. repo is optional, default to ai/. quant is optional, default to :latest.
example: gemma3
(default: unused)
(env: LLAMA_ARG_DOCKER_REPO)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hf | -hfr | --hf-repo )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face model repository; quant is optional, case-insensitive, default to Q4_K_M, or falls back to the first file in the repo if Q4_K_M doesn't exist.
mmproj is also downloaded automatically if available. to disable, add --no-mmproj
example: ggml-org/GLM-4.7-Flash-GGUF:Q4_K_M
(default: unused)
(env: LLAMA_ARG_HF_REPO)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hff | --hf-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face model file. If specified, it will override the quant in --hf-repo (default: unused)
(env: LLAMA_ARG_HF_FILE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hft | --hf-token )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face access token (default: value from HF_TOKEN environment variable)
(env: HF_TOKEN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-disable )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log disable"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log to file
(env: LLAMA_ARG_LOG_FILE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-jsonl )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log as JSONL (one JSON object per line) to stdout, this also disables colored logging (default: disabled)
(env: LLAMA_ARG_LOG_JSONL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-colors )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
Set colored logging ('on', 'off', or 'auto', default: 'auto')
'auto' enables colors when output is to a terminal
(env: LLAMA_ARG_LOG_COLORS)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        -v | --verbose | --log-verbose )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Set verbosity level to infinity (i.e. log all messages, useful for debugging)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --offline )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Offline mode: forces use of cache, prevents network access
(env: LLAMA_ARG_OFFLINE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -lv | --verbosity | --log-verbosity )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Set the verbosity threshold. Messages with a higher verbosity will be ignored. Values:
 - 0: generic output
 - 1: error
 - 2: warning
 - 3: info
 - 4: trace (more info)
 - 5: debug
(default: 3)

(env: LLAMA_ARG_LOG_VERBOSITY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-prefix )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Enable prefix in log messages
(env: LLAMA_ARG_LOG_PREFIX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-timestamps )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Enable timestamps in log messages
(env: LLAMA_ARG_LOG_TIMESTAMPS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-type-k | -ctkd | --cache-type-k-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-type-v | -ctvd | --cache-type-v-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
KV cache data type for V 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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --samplers )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
samplers that will be used for generation in the order, separated by ';'
(default: penalties;dry;top_n_sigma;top_k;typ_p;top_p;min_p;xtc;temperature)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -s | --seed )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RNG seed (default: -1, use random seed for -1)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --sampler-seq | --sampling-seq )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
simplified sequence for samplers that will be used (default: edskypmxt)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --ignore-eos )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ignore end of stream token and continue generating (implies --logit-bias EOS-inf)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --temp | --temperature )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
temperature (default: 0.80)
(env: LLAMA_ARG_TEMPERATURE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-k )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-k sampling (default: 40, 0 = disabled)
(env: LLAMA_ARG_TOP_K)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-p sampling (default: 0.95, 1.0 = disabled)
(env: LLAMA_ARG_TOP_P)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --min-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
min-p sampling (default: 0.05, 0.0 = disabled)
(env: LLAMA_ARG_MIN_P)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-nsigma | --top-n-sigma )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-n-sigma sampling (default: -1.00, -1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --xtc-probability )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
xtc probability (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --xtc-threshold )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
xtc threshold (default: 0.10, 1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --typical | --typical-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
locally typical sampling, parameter p (default: 1.00, 1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repeat-last-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
last n tokens to consider for penalize (default: 64, 0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repeat-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
penalize repeat sequence of tokens (default: 1.00, 1.0 = disabled)
(env: LLAMA_ARG_REPEAT_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --presence-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
repeat alpha presence penalty (default: 0.00, 0.0 = disabled)
(env: LLAMA_ARG_PRESENCE_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --frequency-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
repeat alpha frequency penalty (default: 0.00, 0.0 = disabled)
(env: LLAMA_ARG_FREQUENCY_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-multiplier )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY sampling multiplier (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-base )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY sampling base value (default: 1.75)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-allowed-length )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set allowed length for DRY sampling (default: 2)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-penalty-last-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY penalty for the last n tokens (default: 64, 0 = disable)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-sequence-breaker )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add sequence breaker for DRY sampling, clearing out default breakers ('\\n', ':', '\"', '*') in the process; use \"none\" to not use any sequence breakers
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --adaptive-target )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
adaptive-p: select tokens near this probability (valid range 0.0 to 1.0; negative = disabled) (default: -1.00)
[(more info)](https://github.com/ggml-org/llama.cpp/pull/17927)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --adaptive-decay )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
adaptive-p: 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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dynatemp-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
dynamic temperature range (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dynatemp-exp )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
dynamic temperature exponent (default: 1.00)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use Mirostat sampling.
Top K, Nucleus and Locally Typical samplers are ignored if used.
(default: 0, 0 = disabled, 1 = Mirostat, 2 = Mirostat 2.0)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat-lr )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Mirostat learning rate, parameter eta (default: 0.10)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat-ent )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Mirostat target entropy, parameter tau (default: 5.00)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -l | --logit-bias )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
modifies the likelihood of token appearing in the completion,
i.e. \`--logit-bias 15043+1\` to increase likelihood of token ' Hello',
or \`--logit-bias 15043-1\` to decrease likelihood of token ' Hello'"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --grammar )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
BNF-like grammar to constrain generations (see samples in grammars/ dir)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --grammar-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
file to read grammar from"
            fi
            COMPREPLY=( $(compgen -f -X '!*.gbnf' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -j | --json-schema )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
JSON schema to constrain generations (https://json-schema.org/), e.g. \`{\"type\": \"object\"}\` for any JSON object"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -jf | --json-schema-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
File containing a JSON schema to constrain generations (https://json-schema.org/), e.g. \`{\"type\": \"object\"}\` for any JSON object"
            fi
            COMPREPLY=( $(compgen -f -X '!*.json' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -bs | --backend-sampling )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
enable backend sampling (experimental) (default: disabled)
(env: LLAMA_ARG_BACKEND_SAMPLING)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -gan | --grp-attn-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
group-attention factor (default: 1)
(env: LLAMA_ARG_GRP_ATTN_N)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --junk )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of times to repeat the junk text (default: 250)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --pos )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
position of the passkey in the junk text (default: -1)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
    esac

case "$curr" in
    -* )
        COMPREPLY=( $(compgen -W "${opts}" -- "$curr") )
        return 0
    ;;
esac
} && complete -F _comp_cmd_llama_passkey llama-passkey

_comp_cmd_llama_perplexity()
{
    local curr prev opts
    COMPREPLY=()
    curr="${COMP_WORDS[COMP_CWORD]}"
    prev="${COMP_WORDS[COMP_CWORD-1]}"

    opts="
        -h --help --usage
        --version
        -cl --cache-list
        --completion-bash
        -t --threads
        -tb --threads-batch
        -C --cpu-mask
        -Cr --cpu-range
        --cpu-strict
        --prio
        --poll
        -Cb --cpu-mask-batch
        -Crb --cpu-range-batch
        --cpu-strict-batch
        --prio-batch
        --poll-batch
        -c --ctx-size
        -n --predict --n-predict
        -b --batch-size
        -ub --ubatch-size
        --keep
        --swa-full
        -fa --flash-attn
        -p --prompt
        --perf
        -f --file
        -bf --binary-file
        -e --escape
        --rope-scaling
        --rope-scale
        --rope-freq-base
        --rope-freq-scale
        --yarn-orig-ctx
        --yarn-ext-factor
        --yarn-attn-factor
        --yarn-beta-slow
        --yarn-beta-fast
        -kvo --kv-offload
        --repack
        --no-host
        -ctk --cache-type-k
        -ctv --cache-type-v
        -dt --defrag-thold
        -np --parallel
        --rpc
        -lm --load-mode
        -lzm --lazy-mode
        --numa
        -dev --device
        --list-devices
        -ot --override-tensor
        -cmoe --cpu-moe
        -ncmoe --n-cpu-moe
        --moe-cache-mib
        -ncffn --n-cpu-ffn
        -ngl --gpu-layers --n-gpu-layers
        -sm --split-mode
        -ts --tensor-split
        -mg --main-gpu
        -fit --fit
        -fitt --fit-target
        -fitc --fit-ctx
        --check-tensors
        --override-kv
        --op-offload
        --lora
        --lora-scaled
        --control-vector
        --control-vector-scaled
        --control-vector-layer-range
        -m --model
        -mu --model-url
        -dr --docker-repo
        -hf -hfr --hf-repo
        -hff --hf-file
        -hft --hf-token
        --log-disable
        --log-file
        --log-jsonl
        --log-colors
        -v --verbose --log-verbose
        --offline
        -lv --verbosity --log-verbosity
        --log-prefix
        --log-timestamps
        --spec-draft-type-k -ctkd --cache-type-k-draft
        --spec-draft-type-v -ctvd --cache-type-v-draft
        --samplers
        -s --seed
        --sampler-seq --sampling-seq
        --ignore-eos
        --temp --temperature
        --top-k
        --top-p
        --min-p
        --top-nsigma --top-n-sigma
        --xtc-probability
        --xtc-threshold
        --typical --typical-p
        --repeat-last-n
        --repeat-penalty
        --presence-penalty
        --frequency-penalty
        --dry-multiplier
        --dry-base
        --dry-allowed-length
        --dry-penalty-last-n
        --dry-sequence-breaker
        --adaptive-target
        --adaptive-decay
        --dynatemp-range
        --dynatemp-exp
        --mirostat
        --mirostat-lr
        --mirostat-ent
        -l --logit-bias
        --grammar
        --grammar-file
        -j --json-schema
        -jf --json-schema-file
        -bs --backend-sampling
        -kvu --kv-unified
        --context-shift
        --chunks
        --warmup
        --hellaswag
        --hellaswag-tasks
        --winogrande
        --winogrande-tasks
        --multiple-choice
        --multiple-choice-tasks
        --kl-divergence
        --save-all-logits --kl-divergence-base
        --ppl-stride
        --ppl-output-type
    "

    case "$prev" in
        -h | --help | --usage )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print usage and exit"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --version )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
show version and build info"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -cl | --cache-list )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
show list of models in cache"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --completion-bash )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print source-able bash completion script for llama.cpp"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -t | --threads )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of CPU threads to use during generation (default: -1)
(env: LLAMA_ARG_THREADS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -tb | --threads-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of threads to use during batch and prompt processing (default: same as --threads)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -C | --cpu-mask )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
CPU affinity mask: arbitrarily long hex. Complements cpu-range (default: \"\")"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Cr | --cpu-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
range of CPUs for affinity. Complements --cpu-mask"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --cpu-strict )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use strict CPU placement (default: 0)
"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --prio )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set process/thread priority : low(-1), normal(0), medium(1), high(2), realtime(3) (default: 0)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --poll )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use polling level to wait for work (0 - no polling, default: 50)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Cb | --cpu-mask-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
CPU affinity mask: arbitrarily long hex. Complements cpu-range-batch (default: same as --cpu-mask)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Crb | --cpu-range-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ranges of CPUs for affinity. Complements --cpu-mask-batch"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --cpu-strict-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use strict CPU placement (default: same as --cpu-strict)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --prio-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set process/thread priority : 0-normal, 1-medium, 2-high, 3-realtime (default: 0)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --poll-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use polling to wait for work (default: same as --poll)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        -c | --ctx-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
size of the prompt context (default: 512, 0 = loaded from model)
(env: LLAMA_ARG_CTX_SIZE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -n | --predict | --n-predict )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of tokens to predict (default: -1, -1 = infinity)
(env: LLAMA_ARG_N_PREDICT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -b | --batch-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
logical maximum batch size (default: 2048)
(env: LLAMA_ARG_BATCH)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ub | --ubatch-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
physical maximum batch size (default: 512)
(env: LLAMA_ARG_UBATCH)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --keep )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of tokens to keep from the initial prompt (default: 0, -1 = all)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --swa-full )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fa | --flash-attn )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
set Flash Attention use ('on', 'off', or 'auto', default: 'auto')
(env: LLAMA_ARG_FLASH_ATTN)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        -p | --prompt )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
prompt to start generation with; for system message, use -sys"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --perf )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable internal libllama performance timings (default: false)
(env: LLAMA_ARG_PERF)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -f | --file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
a file containing the prompt (default: none)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -bf | --binary-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
binary file containing the prompt (default: none)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -e | --escape )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to process escapes sequences (\\n, \\r, \\t, \\', \\\", \\\\) (default: false)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-scaling )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
RoPE frequency scaling method, defaults to linear unless specified by the model
(env: LLAMA_ARG_ROPE_SCALING_TYPE)"
            fi
            COMPREPLY=( $(compgen -W 'none linear yarn' -- "$cur") )
            return 0
        ;;
        --rope-scale )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE context scaling factor, expands context by a factor of N
(env: LLAMA_ARG_ROPE_SCALE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-freq-base )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE base frequency, used by NTK-aware scaling (default: loaded from model)
(env: LLAMA_ARG_ROPE_FREQ_BASE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-freq-scale )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE frequency scaling factor, expands context by a factor of 1/N
(env: LLAMA_ARG_ROPE_FREQ_SCALE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-orig-ctx )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: original context size of model (default: 0 = model training context size)
(env: LLAMA_ARG_YARN_ORIG_CTX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-ext-factor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: extrapolation mix factor (default: -1.00, 0.0 = full interpolation)
(env: LLAMA_ARG_YARN_EXT_FACTOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-attn-factor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: scale sqrt(t) or attention magnitude (default: -1.00)
(env: LLAMA_ARG_YARN_ATTN_FACTOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-beta-slow )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: high correction dim or alpha (default: -1.00)
(env: LLAMA_ARG_YARN_BETA_SLOW)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-beta-fast )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: low correction dim or beta (default: -1.00)
(env: LLAMA_ARG_YARN_BETA_FAST)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -kvo | --kv-offload )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable KV cache offloading (default: enabled)
(env: LLAMA_ARG_KV_OFFLOAD)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repack )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable weight repacking (default: enabled)
(env: LLAMA_ARG_REPACK)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --no-host )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
bypass host buffer allowing extra buffers to be used
(env: LLAMA_ARG_NO_HOST)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ctk | --cache-type-k )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ctv | --cache-type-v )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -dt | --defrag-thold )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
KV cache defragmentation threshold (DEPRECATED)
(env: LLAMA_ARG_DEFRAG_THOLD)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -np | --parallel )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of parallel sequences to decode (default: 1)
(env: LLAMA_ARG_N_PARALLEL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rpc )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
comma-separated list of RPC servers (host:port)
(env: LLAMA_ARG_RPC)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -lm | --load-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
model loading mode (default: auto)
- 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)"
            fi
            COMPREPLY=( $(compgen -W 'auto none mmap mlock mmap+mlock dio' -- "$cur") )
            return 0
        ;;
        -lzm | --lazy-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
on-demand reading of certain tensors, for example per-layer embeddings (default: auto)
- on: read the rows of such tensors from disk on demand instead of keeping them resident (requires mmap)
- auto: on, but only for tensors larger than 4 GiB
- off: always keep them resident
(env: LLAMA_ARG_LAZY_MODE)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        --numa )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
attempt optimizations that help on some NUMA systems
- 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)"
            fi
            COMPREPLY=( $(compgen -W 'distribute isolate numactl' -- "$cur") )
            return 0
        ;;
        -dev | --device )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --list-devices )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print list of available devices and exit"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ot | --override-tensor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
override tensor buffer type
(env: LLAMA_ARG_OVERRIDE_TENSOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -cmoe | --cpu-moe )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep all Mixture of Experts (MoE) weights in the CPU
(env: LLAMA_ARG_CPU_MOE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ncmoe | --n-cpu-moe )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep the Mixture of Experts (MoE) weights of the first N layers in the CPU
(env: LLAMA_ARG_N_CPU_MOE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --moe-cache-mib )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
GPU cache size in MiB for the MoE experts kept in the CPU. with multiple GPUs, it is split among them like the layers (--tensor-split) (default: 0, disabled)
(env: LLAMA_ARG_MOE_CACHE_MIB)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ncffn | --n-cpu-ffn )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep the dense FFN weights of the first N layers in the CPU
(dense models; for MoE expert weights use --n-cpu-moe)
(env: LLAMA_ARG_N_CPU_FFN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ngl | --gpu-layers | --n-gpu-layers )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
max. number of layers to store in VRAM, either an exact number, 'auto', or 'all' (default: auto)
(env: LLAMA_ARG_N_GPU_LAYERS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -sm | --split-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
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)"
            fi
            COMPREPLY=( $(compgen -W 'none layer row split' -- "$cur") )
            return 0
        ;;
        -ts | --tensor-split )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
fraction of the model to offload to each GPU, comma-separated list of proportions, e.g. 3,1
(env: LLAMA_ARG_TENSOR_SPLIT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -mg | --main-gpu )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fit | --fit )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
whether to adjust unset arguments to fit in device memory ('on' or 'off', default: 'on')
(env: LLAMA_ARG_FIT)"
            fi
            COMPREPLY=( $(compgen -W 'on off' -- "$cur") )
            return 0
        ;;
        -fitt | --fit-target )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fitc | --fit-ctx )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
minimum ctx size that can be set by --fit option, default: 4096
(env: LLAMA_ARG_FIT_CTX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --check-tensors )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
check model tensor data for invalid values (default: false)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --override-kv )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --op-offload )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to offload host tensor operations to device (default: true)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --lora )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to LoRA adapter (use comma-separated values to load multiple adapters)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --lora-scaled )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to LoRA adapter with user defined scaling (format: FNAME:SCALE,...)
note: use comma-separated values"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add a control vector
note: use comma-separated values to add multiple control vectors"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector-scaled )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add a control vector with user defined scaling SCALE
note: use comma-separated values (format: FNAME:SCALE,...)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector-layer-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
layer range to apply the control vector(s) to, start and end inclusive"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -m | --model )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
model path to load
(env: LLAMA_ARG_MODEL)"
            fi
            COMPREPLY=( $(compgen -f -X '!*.gguf' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -mu | --model-url )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
model download url (default: unused)
(env: LLAMA_ARG_MODEL_URL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -dr | --docker-repo )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Docker Hub model repository. repo is optional, default to ai/. quant is optional, default to :latest.
example: gemma3
(default: unused)
(env: LLAMA_ARG_DOCKER_REPO)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hf | -hfr | --hf-repo )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face model repository; quant is optional, case-insensitive, default to Q4_K_M, or falls back to the first file in the repo if Q4_K_M doesn't exist.
mmproj is also downloaded automatically if available. to disable, add --no-mmproj
example: ggml-org/GLM-4.7-Flash-GGUF:Q4_K_M
(default: unused)
(env: LLAMA_ARG_HF_REPO)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hff | --hf-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face model file. If specified, it will override the quant in --hf-repo (default: unused)
(env: LLAMA_ARG_HF_FILE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hft | --hf-token )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face access token (default: value from HF_TOKEN environment variable)
(env: HF_TOKEN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-disable )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log disable"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log to file
(env: LLAMA_ARG_LOG_FILE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-jsonl )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log as JSONL (one JSON object per line) to stdout, this also disables colored logging (default: disabled)
(env: LLAMA_ARG_LOG_JSONL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-colors )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
Set colored logging ('on', 'off', or 'auto', default: 'auto')
'auto' enables colors when output is to a terminal
(env: LLAMA_ARG_LOG_COLORS)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        -v | --verbose | --log-verbose )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Set verbosity level to infinity (i.e. log all messages, useful for debugging)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --offline )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Offline mode: forces use of cache, prevents network access
(env: LLAMA_ARG_OFFLINE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -lv | --verbosity | --log-verbosity )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Set the verbosity threshold. Messages with a higher verbosity will be ignored. Values:
 - 0: generic output
 - 1: error
 - 2: warning
 - 3: info
 - 4: trace (more info)
 - 5: debug
(default: 3)

(env: LLAMA_ARG_LOG_VERBOSITY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-prefix )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Enable prefix in log messages
(env: LLAMA_ARG_LOG_PREFIX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-timestamps )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Enable timestamps in log messages
(env: LLAMA_ARG_LOG_TIMESTAMPS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-type-k | -ctkd | --cache-type-k-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-type-v | -ctvd | --cache-type-v-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
KV cache data type for V 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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --samplers )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
samplers that will be used for generation in the order, separated by ';'
(default: penalties;dry;top_n_sigma;top_k;typ_p;top_p;min_p;xtc;temperature)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -s | --seed )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RNG seed (default: -1, use random seed for -1)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --sampler-seq | --sampling-seq )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
simplified sequence for samplers that will be used (default: edskypmxt)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --ignore-eos )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ignore end of stream token and continue generating (implies --logit-bias EOS-inf)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --temp | --temperature )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
temperature (default: 0.80)
(env: LLAMA_ARG_TEMPERATURE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-k )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-k sampling (default: 40, 0 = disabled)
(env: LLAMA_ARG_TOP_K)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-p sampling (default: 0.95, 1.0 = disabled)
(env: LLAMA_ARG_TOP_P)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --min-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
min-p sampling (default: 0.05, 0.0 = disabled)
(env: LLAMA_ARG_MIN_P)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-nsigma | --top-n-sigma )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-n-sigma sampling (default: -1.00, -1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --xtc-probability )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
xtc probability (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --xtc-threshold )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
xtc threshold (default: 0.10, 1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --typical | --typical-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
locally typical sampling, parameter p (default: 1.00, 1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repeat-last-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
last n tokens to consider for penalize (default: 64, 0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repeat-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
penalize repeat sequence of tokens (default: 1.00, 1.0 = disabled)
(env: LLAMA_ARG_REPEAT_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --presence-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
repeat alpha presence penalty (default: 0.00, 0.0 = disabled)
(env: LLAMA_ARG_PRESENCE_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --frequency-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
repeat alpha frequency penalty (default: 0.00, 0.0 = disabled)
(env: LLAMA_ARG_FREQUENCY_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-multiplier )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY sampling multiplier (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-base )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY sampling base value (default: 1.75)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-allowed-length )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set allowed length for DRY sampling (default: 2)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-penalty-last-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY penalty for the last n tokens (default: 64, 0 = disable)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-sequence-breaker )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add sequence breaker for DRY sampling, clearing out default breakers ('\\n', ':', '\"', '*') in the process; use \"none\" to not use any sequence breakers
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --adaptive-target )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
adaptive-p: select tokens near this probability (valid range 0.0 to 1.0; negative = disabled) (default: -1.00)
[(more info)](https://github.com/ggml-org/llama.cpp/pull/17927)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --adaptive-decay )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
adaptive-p: 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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dynatemp-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
dynamic temperature range (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dynatemp-exp )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
dynamic temperature exponent (default: 1.00)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use Mirostat sampling.
Top K, Nucleus and Locally Typical samplers are ignored if used.
(default: 0, 0 = disabled, 1 = Mirostat, 2 = Mirostat 2.0)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat-lr )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Mirostat learning rate, parameter eta (default: 0.10)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat-ent )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Mirostat target entropy, parameter tau (default: 5.00)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -l | --logit-bias )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
modifies the likelihood of token appearing in the completion,
i.e. \`--logit-bias 15043+1\` to increase likelihood of token ' Hello',
or \`--logit-bias 15043-1\` to decrease likelihood of token ' Hello'"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --grammar )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
BNF-like grammar to constrain generations (see samples in grammars/ dir)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --grammar-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
file to read grammar from"
            fi
            COMPREPLY=( $(compgen -f -X '!*.gbnf' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -j | --json-schema )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
JSON schema to constrain generations (https://json-schema.org/), e.g. \`{\"type\": \"object\"}\` for any JSON object"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -jf | --json-schema-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
File containing a JSON schema to constrain generations (https://json-schema.org/), e.g. \`{\"type\": \"object\"}\` for any JSON object"
            fi
            COMPREPLY=( $(compgen -f -X '!*.json' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -bs | --backend-sampling )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
enable backend sampling (experimental) (default: disabled)
(env: LLAMA_ARG_BACKEND_SAMPLING)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -kvu | --kv-unified )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use single unified KV buffer shared across all sequences (default: enabled if number of slots is auto)
(env: LLAMA_ARG_KV_UNIFIED)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --context-shift )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to use context shift on infinite text generation (default: disabled)
(env: LLAMA_ARG_CONTEXT_SHIFT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --chunks )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
max number of chunks to process (default: -1, -1 = all)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --warmup )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to perform warmup with an empty run (default: enabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --hellaswag )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
compute HellaSwag score over random tasks from datafile supplied with -f"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --hellaswag-tasks )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of tasks to use when computing the HellaSwag score (default: 400)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --winogrande )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
compute Winogrande score over random tasks from datafile supplied with -f"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --winogrande-tasks )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of tasks to use when computing the Winogrande score (default: 0)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --multiple-choice )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
compute multiple choice score over random tasks from datafile supplied with -f"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --multiple-choice-tasks )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of tasks to use when computing the multiple choice score (default: 0)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --kl-divergence )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
computes KL-divergence to logits provided via --kl-divergence-base"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --save-all-logits | --kl-divergence-base )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set logits file"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --ppl-stride )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
stride for perplexity calculation (default: 0)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --ppl-output-type )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
output type for perplexity calculation (default: 0)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
    esac

case "$curr" in
    -* )
        COMPREPLY=( $(compgen -W "${opts}" -- "$curr") )
        return 0
    ;;
esac
} && complete -F _comp_cmd_llama_perplexity llama-perplexity

_comp_cmd_llama_results()
{
    local curr prev opts
    COMPREPLY=()
    curr="${COMP_WORDS[COMP_CWORD]}"
    prev="${COMP_WORDS[COMP_CWORD-1]}"

    opts="
        -h --help --usage
        --version
        -cl --cache-list
        --completion-bash
        -t --threads
        -tb --threads-batch
        -C --cpu-mask
        -Cr --cpu-range
        --cpu-strict
        --prio
        --poll
        -Cb --cpu-mask-batch
        -Crb --cpu-range-batch
        --cpu-strict-batch
        --prio-batch
        --poll-batch
        -c --ctx-size
        -n --predict --n-predict
        -b --batch-size
        -ub --ubatch-size
        --keep
        --swa-full
        -fa --flash-attn
        -p --prompt
        --perf
        -f --file
        -bf --binary-file
        -e --escape
        --rope-scaling
        --rope-scale
        --rope-freq-base
        --rope-freq-scale
        --yarn-orig-ctx
        --yarn-ext-factor
        --yarn-attn-factor
        --yarn-beta-slow
        --yarn-beta-fast
        -kvo --kv-offload
        --repack
        --no-host
        -ctk --cache-type-k
        -ctv --cache-type-v
        -dt --defrag-thold
        -np --parallel
        --rpc
        -lm --load-mode
        -lzm --lazy-mode
        --numa
        -dev --device
        --list-devices
        -ot --override-tensor
        -cmoe --cpu-moe
        -ncmoe --n-cpu-moe
        --moe-cache-mib
        -ncffn --n-cpu-ffn
        -ngl --gpu-layers --n-gpu-layers
        -sm --split-mode
        -ts --tensor-split
        -mg --main-gpu
        -fit --fit
        -fitt --fit-target
        -fitc --fit-ctx
        --check-tensors
        --override-kv
        --op-offload
        --lora
        --lora-scaled
        --control-vector
        --control-vector-scaled
        --control-vector-layer-range
        -m --model
        -mu --model-url
        -dr --docker-repo
        -hf -hfr --hf-repo
        -hff --hf-file
        -hft --hf-token
        --log-disable
        --log-file
        --log-jsonl
        --log-colors
        -v --verbose --log-verbose
        --offline
        -lv --verbosity --log-verbosity
        --log-prefix
        --log-timestamps
        --spec-draft-type-k -ctkd --cache-type-k-draft
        --spec-draft-type-v -ctvd --cache-type-v-draft
        --samplers
        -s --seed
        --sampler-seq --sampling-seq
        --ignore-eos
        --temp --temperature
        --top-k
        --top-p
        --min-p
        --top-nsigma --top-n-sigma
        --xtc-probability
        --xtc-threshold
        --typical --typical-p
        --repeat-last-n
        --repeat-penalty
        --presence-penalty
        --frequency-penalty
        --dry-multiplier
        --dry-base
        --dry-allowed-length
        --dry-penalty-last-n
        --dry-sequence-breaker
        --adaptive-target
        --adaptive-decay
        --dynatemp-range
        --dynatemp-exp
        --mirostat
        --mirostat-lr
        --mirostat-ent
        -l --logit-bias
        --grammar
        --grammar-file
        -j --json-schema
        -jf --json-schema-file
        -bs --backend-sampling
        -o --output --output-file
        --check
    "

    case "$prev" in
        -h | --help | --usage )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print usage and exit"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --version )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
show version and build info"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -cl | --cache-list )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
show list of models in cache"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --completion-bash )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print source-able bash completion script for llama.cpp"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -t | --threads )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of CPU threads to use during generation (default: -1)
(env: LLAMA_ARG_THREADS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -tb | --threads-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of threads to use during batch and prompt processing (default: same as --threads)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -C | --cpu-mask )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
CPU affinity mask: arbitrarily long hex. Complements cpu-range (default: \"\")"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Cr | --cpu-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
range of CPUs for affinity. Complements --cpu-mask"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --cpu-strict )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use strict CPU placement (default: 0)
"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --prio )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set process/thread priority : low(-1), normal(0), medium(1), high(2), realtime(3) (default: 0)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --poll )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use polling level to wait for work (0 - no polling, default: 50)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Cb | --cpu-mask-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
CPU affinity mask: arbitrarily long hex. Complements cpu-range-batch (default: same as --cpu-mask)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Crb | --cpu-range-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ranges of CPUs for affinity. Complements --cpu-mask-batch"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --cpu-strict-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use strict CPU placement (default: same as --cpu-strict)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --prio-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set process/thread priority : 0-normal, 1-medium, 2-high, 3-realtime (default: 0)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --poll-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use polling to wait for work (default: same as --poll)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        -c | --ctx-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
size of the prompt context (default: 0, 0 = loaded from model)
(env: LLAMA_ARG_CTX_SIZE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -n | --predict | --n-predict )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of tokens to predict (default: -1, -1 = infinity)
(env: LLAMA_ARG_N_PREDICT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -b | --batch-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
logical maximum batch size (default: 2048)
(env: LLAMA_ARG_BATCH)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ub | --ubatch-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
physical maximum batch size (default: 512)
(env: LLAMA_ARG_UBATCH)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --keep )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of tokens to keep from the initial prompt (default: 0, -1 = all)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --swa-full )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fa | --flash-attn )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
set Flash Attention use ('on', 'off', or 'auto', default: 'auto')
(env: LLAMA_ARG_FLASH_ATTN)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        -p | --prompt )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
prompt to start generation with; for system message, use -sys"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --perf )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable internal libllama performance timings (default: false)
(env: LLAMA_ARG_PERF)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -f | --file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
a file containing the prompt (default: none)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -bf | --binary-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
binary file containing the prompt (default: none)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -e | --escape )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to process escapes sequences (\\n, \\r, \\t, \\', \\\", \\\\) (default: false)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-scaling )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
RoPE frequency scaling method, defaults to linear unless specified by the model
(env: LLAMA_ARG_ROPE_SCALING_TYPE)"
            fi
            COMPREPLY=( $(compgen -W 'none linear yarn' -- "$cur") )
            return 0
        ;;
        --rope-scale )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE context scaling factor, expands context by a factor of N
(env: LLAMA_ARG_ROPE_SCALE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-freq-base )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE base frequency, used by NTK-aware scaling (default: loaded from model)
(env: LLAMA_ARG_ROPE_FREQ_BASE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-freq-scale )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE frequency scaling factor, expands context by a factor of 1/N
(env: LLAMA_ARG_ROPE_FREQ_SCALE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-orig-ctx )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: original context size of model (default: 0 = model training context size)
(env: LLAMA_ARG_YARN_ORIG_CTX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-ext-factor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: extrapolation mix factor (default: -1.00, 0.0 = full interpolation)
(env: LLAMA_ARG_YARN_EXT_FACTOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-attn-factor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: scale sqrt(t) or attention magnitude (default: -1.00)
(env: LLAMA_ARG_YARN_ATTN_FACTOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-beta-slow )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: high correction dim or alpha (default: -1.00)
(env: LLAMA_ARG_YARN_BETA_SLOW)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-beta-fast )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: low correction dim or beta (default: -1.00)
(env: LLAMA_ARG_YARN_BETA_FAST)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -kvo | --kv-offload )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable KV cache offloading (default: enabled)
(env: LLAMA_ARG_KV_OFFLOAD)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repack )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable weight repacking (default: enabled)
(env: LLAMA_ARG_REPACK)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --no-host )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
bypass host buffer allowing extra buffers to be used
(env: LLAMA_ARG_NO_HOST)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ctk | --cache-type-k )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ctv | --cache-type-v )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -dt | --defrag-thold )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
KV cache defragmentation threshold (DEPRECATED)
(env: LLAMA_ARG_DEFRAG_THOLD)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -np | --parallel )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of parallel sequences to decode (default: 1)
(env: LLAMA_ARG_N_PARALLEL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rpc )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
comma-separated list of RPC servers (host:port)
(env: LLAMA_ARG_RPC)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -lm | --load-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
model loading mode (default: auto)
- 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)"
            fi
            COMPREPLY=( $(compgen -W 'auto none mmap mlock mmap+mlock dio' -- "$cur") )
            return 0
        ;;
        -lzm | --lazy-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
on-demand reading of certain tensors, for example per-layer embeddings (default: auto)
- on: read the rows of such tensors from disk on demand instead of keeping them resident (requires mmap)
- auto: on, but only for tensors larger than 4 GiB
- off: always keep them resident
(env: LLAMA_ARG_LAZY_MODE)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        --numa )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
attempt optimizations that help on some NUMA systems
- 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)"
            fi
            COMPREPLY=( $(compgen -W 'distribute isolate numactl' -- "$cur") )
            return 0
        ;;
        -dev | --device )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --list-devices )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print list of available devices and exit"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ot | --override-tensor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
override tensor buffer type
(env: LLAMA_ARG_OVERRIDE_TENSOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -cmoe | --cpu-moe )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep all Mixture of Experts (MoE) weights in the CPU
(env: LLAMA_ARG_CPU_MOE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ncmoe | --n-cpu-moe )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep the Mixture of Experts (MoE) weights of the first N layers in the CPU
(env: LLAMA_ARG_N_CPU_MOE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --moe-cache-mib )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
GPU cache size in MiB for the MoE experts kept in the CPU. with multiple GPUs, it is split among them like the layers (--tensor-split) (default: 0, disabled)
(env: LLAMA_ARG_MOE_CACHE_MIB)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ncffn | --n-cpu-ffn )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep the dense FFN weights of the first N layers in the CPU
(dense models; for MoE expert weights use --n-cpu-moe)
(env: LLAMA_ARG_N_CPU_FFN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ngl | --gpu-layers | --n-gpu-layers )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
max. number of layers to store in VRAM, either an exact number, 'auto', or 'all' (default: auto)
(env: LLAMA_ARG_N_GPU_LAYERS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -sm | --split-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
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)"
            fi
            COMPREPLY=( $(compgen -W 'none layer row split' -- "$cur") )
            return 0
        ;;
        -ts | --tensor-split )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
fraction of the model to offload to each GPU, comma-separated list of proportions, e.g. 3,1
(env: LLAMA_ARG_TENSOR_SPLIT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -mg | --main-gpu )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fit | --fit )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
whether to adjust unset arguments to fit in device memory ('on' or 'off', default: 'on')
(env: LLAMA_ARG_FIT)"
            fi
            COMPREPLY=( $(compgen -W 'on off' -- "$cur") )
            return 0
        ;;
        -fitt | --fit-target )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fitc | --fit-ctx )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
minimum ctx size that can be set by --fit option, default: 4096
(env: LLAMA_ARG_FIT_CTX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --check-tensors )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
check model tensor data for invalid values (default: false)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --override-kv )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --op-offload )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to offload host tensor operations to device (default: true)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --lora )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to LoRA adapter (use comma-separated values to load multiple adapters)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --lora-scaled )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to LoRA adapter with user defined scaling (format: FNAME:SCALE,...)
note: use comma-separated values"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add a control vector
note: use comma-separated values to add multiple control vectors"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector-scaled )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add a control vector with user defined scaling SCALE
note: use comma-separated values (format: FNAME:SCALE,...)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector-layer-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
layer range to apply the control vector(s) to, start and end inclusive"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -m | --model )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
model path to load
(env: LLAMA_ARG_MODEL)"
            fi
            COMPREPLY=( $(compgen -f -X '!*.gguf' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -mu | --model-url )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
model download url (default: unused)
(env: LLAMA_ARG_MODEL_URL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -dr | --docker-repo )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Docker Hub model repository. repo is optional, default to ai/. quant is optional, default to :latest.
example: gemma3
(default: unused)
(env: LLAMA_ARG_DOCKER_REPO)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hf | -hfr | --hf-repo )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face model repository; quant is optional, case-insensitive, default to Q4_K_M, or falls back to the first file in the repo if Q4_K_M doesn't exist.
mmproj is also downloaded automatically if available. to disable, add --no-mmproj
example: ggml-org/GLM-4.7-Flash-GGUF:Q4_K_M
(default: unused)
(env: LLAMA_ARG_HF_REPO)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hff | --hf-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face model file. If specified, it will override the quant in --hf-repo (default: unused)
(env: LLAMA_ARG_HF_FILE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hft | --hf-token )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face access token (default: value from HF_TOKEN environment variable)
(env: HF_TOKEN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-disable )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log disable"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log to file
(env: LLAMA_ARG_LOG_FILE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-jsonl )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log as JSONL (one JSON object per line) to stdout, this also disables colored logging (default: disabled)
(env: LLAMA_ARG_LOG_JSONL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-colors )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
Set colored logging ('on', 'off', or 'auto', default: 'auto')
'auto' enables colors when output is to a terminal
(env: LLAMA_ARG_LOG_COLORS)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        -v | --verbose | --log-verbose )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Set verbosity level to infinity (i.e. log all messages, useful for debugging)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --offline )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Offline mode: forces use of cache, prevents network access
(env: LLAMA_ARG_OFFLINE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -lv | --verbosity | --log-verbosity )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Set the verbosity threshold. Messages with a higher verbosity will be ignored. Values:
 - 0: generic output
 - 1: error
 - 2: warning
 - 3: info
 - 4: trace (more info)
 - 5: debug
(default: 3)

(env: LLAMA_ARG_LOG_VERBOSITY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-prefix )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Enable prefix in log messages
(env: LLAMA_ARG_LOG_PREFIX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-timestamps )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Enable timestamps in log messages
(env: LLAMA_ARG_LOG_TIMESTAMPS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-type-k | -ctkd | --cache-type-k-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-type-v | -ctvd | --cache-type-v-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
KV cache data type for V 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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --samplers )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
samplers that will be used for generation in the order, separated by ';'
(default: penalties;dry;top_n_sigma;top_k;typ_p;top_p;min_p;xtc;temperature)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -s | --seed )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RNG seed (default: -1, use random seed for -1)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --sampler-seq | --sampling-seq )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
simplified sequence for samplers that will be used (default: edskypmxt)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --ignore-eos )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ignore end of stream token and continue generating (implies --logit-bias EOS-inf)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --temp | --temperature )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
temperature (default: 0.80)
(env: LLAMA_ARG_TEMPERATURE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-k )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-k sampling (default: 40, 0 = disabled)
(env: LLAMA_ARG_TOP_K)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-p sampling (default: 0.95, 1.0 = disabled)
(env: LLAMA_ARG_TOP_P)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --min-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
min-p sampling (default: 0.05, 0.0 = disabled)
(env: LLAMA_ARG_MIN_P)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-nsigma | --top-n-sigma )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-n-sigma sampling (default: -1.00, -1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --xtc-probability )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
xtc probability (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --xtc-threshold )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
xtc threshold (default: 0.10, 1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --typical | --typical-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
locally typical sampling, parameter p (default: 1.00, 1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repeat-last-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
last n tokens to consider for penalize (default: 64, 0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repeat-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
penalize repeat sequence of tokens (default: 1.00, 1.0 = disabled)
(env: LLAMA_ARG_REPEAT_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --presence-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
repeat alpha presence penalty (default: 0.00, 0.0 = disabled)
(env: LLAMA_ARG_PRESENCE_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --frequency-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
repeat alpha frequency penalty (default: 0.00, 0.0 = disabled)
(env: LLAMA_ARG_FREQUENCY_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-multiplier )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY sampling multiplier (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-base )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY sampling base value (default: 1.75)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-allowed-length )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set allowed length for DRY sampling (default: 2)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-penalty-last-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY penalty for the last n tokens (default: 64, 0 = disable)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-sequence-breaker )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add sequence breaker for DRY sampling, clearing out default breakers ('\\n', ':', '\"', '*') in the process; use \"none\" to not use any sequence breakers
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --adaptive-target )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
adaptive-p: select tokens near this probability (valid range 0.0 to 1.0; negative = disabled) (default: -1.00)
[(more info)](https://github.com/ggml-org/llama.cpp/pull/17927)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --adaptive-decay )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
adaptive-p: 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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dynatemp-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
dynamic temperature range (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dynatemp-exp )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
dynamic temperature exponent (default: 1.00)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use Mirostat sampling.
Top K, Nucleus and Locally Typical samplers are ignored if used.
(default: 0, 0 = disabled, 1 = Mirostat, 2 = Mirostat 2.0)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat-lr )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Mirostat learning rate, parameter eta (default: 0.10)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat-ent )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Mirostat target entropy, parameter tau (default: 5.00)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -l | --logit-bias )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
modifies the likelihood of token appearing in the completion,
i.e. \`--logit-bias 15043+1\` to increase likelihood of token ' Hello',
or \`--logit-bias 15043-1\` to decrease likelihood of token ' Hello'"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --grammar )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
BNF-like grammar to constrain generations (see samples in grammars/ dir)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --grammar-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
file to read grammar from"
            fi
            COMPREPLY=( $(compgen -f -X '!*.gbnf' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -j | --json-schema )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
JSON schema to constrain generations (https://json-schema.org/), e.g. \`{\"type\": \"object\"}\` for any JSON object"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -jf | --json-schema-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
File containing a JSON schema to constrain generations (https://json-schema.org/), e.g. \`{\"type\": \"object\"}\` for any JSON object"
            fi
            COMPREPLY=( $(compgen -f -X '!*.json' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -bs | --backend-sampling )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
enable backend sampling (experimental) (default: disabled)
(env: LLAMA_ARG_BACKEND_SAMPLING)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -o | --output | --output-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
output file (default: '')"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --check )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
check rather than generate results (default: false)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
    esac

case "$curr" in
    -* )
        COMPREPLY=( $(compgen -W "${opts}" -- "$curr") )
        return 0
    ;;
esac
} && complete -F _comp_cmd_llama_results llama-results

_comp_cmd_llama_retrieval()
{
    local curr prev opts
    COMPREPLY=()
    curr="${COMP_WORDS[COMP_CWORD]}"
    prev="${COMP_WORDS[COMP_CWORD-1]}"

    opts="
        -h --help --usage
        --version
        -cl --cache-list
        --completion-bash
        -t --threads
        -tb --threads-batch
        -C --cpu-mask
        -Cr --cpu-range
        --cpu-strict
        --prio
        --poll
        -Cb --cpu-mask-batch
        -Crb --cpu-range-batch
        --cpu-strict-batch
        --prio-batch
        --poll-batch
        -c --ctx-size
        -n --predict --n-predict
        -b --batch-size
        -ub --ubatch-size
        --keep
        --swa-full
        -fa --flash-attn
        -p --prompt
        --perf
        -f --file
        -bf --binary-file
        -e --escape
        --rope-scaling
        --rope-scale
        --rope-freq-base
        --rope-freq-scale
        --yarn-orig-ctx
        --yarn-ext-factor
        --yarn-attn-factor
        --yarn-beta-slow
        --yarn-beta-fast
        -kvo --kv-offload
        --repack
        --no-host
        -ctk --cache-type-k
        -ctv --cache-type-v
        -dt --defrag-thold
        -np --parallel
        --rpc
        -lm --load-mode
        -lzm --lazy-mode
        --numa
        -dev --device
        --list-devices
        -ot --override-tensor
        -cmoe --cpu-moe
        -ncmoe --n-cpu-moe
        --moe-cache-mib
        -ncffn --n-cpu-ffn
        -ngl --gpu-layers --n-gpu-layers
        -sm --split-mode
        -ts --tensor-split
        -mg --main-gpu
        -fit --fit
        -fitt --fit-target
        -fitc --fit-ctx
        --check-tensors
        --override-kv
        --op-offload
        --lora
        --lora-scaled
        --control-vector
        --control-vector-scaled
        --control-vector-layer-range
        -m --model
        -mu --model-url
        -dr --docker-repo
        -hf -hfr --hf-repo
        -hff --hf-file
        -hft --hf-token
        --log-disable
        --log-file
        --log-jsonl
        --log-colors
        -v --verbose --log-verbose
        --offline
        -lv --verbosity --log-verbosity
        --log-prefix
        --log-timestamps
        --spec-draft-type-k -ctkd --cache-type-k-draft
        --spec-draft-type-v -ctvd --cache-type-v-draft
        --samplers
        -s --seed
        --sampler-seq --sampling-seq
        --ignore-eos
        --temp --temperature
        --top-k
        --top-p
        --min-p
        --top-nsigma --top-n-sigma
        --xtc-probability
        --xtc-threshold
        --typical --typical-p
        --repeat-last-n
        --repeat-penalty
        --presence-penalty
        --frequency-penalty
        --dry-multiplier
        --dry-base
        --dry-allowed-length
        --dry-penalty-last-n
        --dry-sequence-breaker
        --adaptive-target
        --adaptive-decay
        --dynatemp-range
        --dynatemp-exp
        --mirostat
        --mirostat-lr
        --mirostat-ent
        -l --logit-bias
        --grammar
        --grammar-file
        -j --json-schema
        -jf --json-schema-file
        -bs --backend-sampling
        --verbose-prompt
        --chunks
        --warmup
        --pooling
        --context-file
        --chunk-size
        --chunk-separator
    "

    case "$prev" in
        -h | --help | --usage )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print usage and exit"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --version )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
show version and build info"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -cl | --cache-list )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
show list of models in cache"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --completion-bash )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print source-able bash completion script for llama.cpp"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -t | --threads )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of CPU threads to use during generation (default: -1)
(env: LLAMA_ARG_THREADS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -tb | --threads-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of threads to use during batch and prompt processing (default: same as --threads)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -C | --cpu-mask )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
CPU affinity mask: arbitrarily long hex. Complements cpu-range (default: \"\")"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Cr | --cpu-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
range of CPUs for affinity. Complements --cpu-mask"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --cpu-strict )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use strict CPU placement (default: 0)
"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --prio )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set process/thread priority : low(-1), normal(0), medium(1), high(2), realtime(3) (default: 0)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --poll )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use polling level to wait for work (0 - no polling, default: 50)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Cb | --cpu-mask-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
CPU affinity mask: arbitrarily long hex. Complements cpu-range-batch (default: same as --cpu-mask)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Crb | --cpu-range-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ranges of CPUs for affinity. Complements --cpu-mask-batch"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --cpu-strict-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use strict CPU placement (default: same as --cpu-strict)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --prio-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set process/thread priority : 0-normal, 1-medium, 2-high, 3-realtime (default: 0)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --poll-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use polling to wait for work (default: same as --poll)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        -c | --ctx-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
size of the prompt context (default: 0, 0 = loaded from model)
(env: LLAMA_ARG_CTX_SIZE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -n | --predict | --n-predict )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of tokens to predict (default: -1, -1 = infinity)
(env: LLAMA_ARG_N_PREDICT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -b | --batch-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
logical maximum batch size (default: 2048)
(env: LLAMA_ARG_BATCH)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ub | --ubatch-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
physical maximum batch size (default: 512)
(env: LLAMA_ARG_UBATCH)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --keep )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of tokens to keep from the initial prompt (default: 0, -1 = all)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --swa-full )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fa | --flash-attn )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
set Flash Attention use ('on', 'off', or 'auto', default: 'auto')
(env: LLAMA_ARG_FLASH_ATTN)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        -p | --prompt )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
prompt to start generation with; for system message, use -sys"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --perf )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable internal libllama performance timings (default: false)
(env: LLAMA_ARG_PERF)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -f | --file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
a file containing the prompt (default: none)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -bf | --binary-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
binary file containing the prompt (default: none)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -e | --escape )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to process escapes sequences (\\n, \\r, \\t, \\', \\\", \\\\) (default: true)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-scaling )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
RoPE frequency scaling method, defaults to linear unless specified by the model
(env: LLAMA_ARG_ROPE_SCALING_TYPE)"
            fi
            COMPREPLY=( $(compgen -W 'none linear yarn' -- "$cur") )
            return 0
        ;;
        --rope-scale )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE context scaling factor, expands context by a factor of N
(env: LLAMA_ARG_ROPE_SCALE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-freq-base )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE base frequency, used by NTK-aware scaling (default: loaded from model)
(env: LLAMA_ARG_ROPE_FREQ_BASE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-freq-scale )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE frequency scaling factor, expands context by a factor of 1/N
(env: LLAMA_ARG_ROPE_FREQ_SCALE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-orig-ctx )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: original context size of model (default: 0 = model training context size)
(env: LLAMA_ARG_YARN_ORIG_CTX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-ext-factor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: extrapolation mix factor (default: -1.00, 0.0 = full interpolation)
(env: LLAMA_ARG_YARN_EXT_FACTOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-attn-factor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: scale sqrt(t) or attention magnitude (default: -1.00)
(env: LLAMA_ARG_YARN_ATTN_FACTOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-beta-slow )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: high correction dim or alpha (default: -1.00)
(env: LLAMA_ARG_YARN_BETA_SLOW)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-beta-fast )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: low correction dim or beta (default: -1.00)
(env: LLAMA_ARG_YARN_BETA_FAST)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -kvo | --kv-offload )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable KV cache offloading (default: enabled)
(env: LLAMA_ARG_KV_OFFLOAD)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repack )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable weight repacking (default: enabled)
(env: LLAMA_ARG_REPACK)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --no-host )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
bypass host buffer allowing extra buffers to be used
(env: LLAMA_ARG_NO_HOST)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ctk | --cache-type-k )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ctv | --cache-type-v )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -dt | --defrag-thold )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
KV cache defragmentation threshold (DEPRECATED)
(env: LLAMA_ARG_DEFRAG_THOLD)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -np | --parallel )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of parallel sequences to decode (default: 1)
(env: LLAMA_ARG_N_PARALLEL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rpc )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
comma-separated list of RPC servers (host:port)
(env: LLAMA_ARG_RPC)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -lm | --load-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
model loading mode (default: auto)
- 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)"
            fi
            COMPREPLY=( $(compgen -W 'auto none mmap mlock mmap+mlock dio' -- "$cur") )
            return 0
        ;;
        -lzm | --lazy-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
on-demand reading of certain tensors, for example per-layer embeddings (default: auto)
- on: read the rows of such tensors from disk on demand instead of keeping them resident (requires mmap)
- auto: on, but only for tensors larger than 4 GiB
- off: always keep them resident
(env: LLAMA_ARG_LAZY_MODE)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        --numa )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
attempt optimizations that help on some NUMA systems
- 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)"
            fi
            COMPREPLY=( $(compgen -W 'distribute isolate numactl' -- "$cur") )
            return 0
        ;;
        -dev | --device )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --list-devices )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print list of available devices and exit"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ot | --override-tensor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
override tensor buffer type
(env: LLAMA_ARG_OVERRIDE_TENSOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -cmoe | --cpu-moe )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep all Mixture of Experts (MoE) weights in the CPU
(env: LLAMA_ARG_CPU_MOE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ncmoe | --n-cpu-moe )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep the Mixture of Experts (MoE) weights of the first N layers in the CPU
(env: LLAMA_ARG_N_CPU_MOE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --moe-cache-mib )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
GPU cache size in MiB for the MoE experts kept in the CPU. with multiple GPUs, it is split among them like the layers (--tensor-split) (default: 0, disabled)
(env: LLAMA_ARG_MOE_CACHE_MIB)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ncffn | --n-cpu-ffn )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep the dense FFN weights of the first N layers in the CPU
(dense models; for MoE expert weights use --n-cpu-moe)
(env: LLAMA_ARG_N_CPU_FFN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ngl | --gpu-layers | --n-gpu-layers )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
max. number of layers to store in VRAM, either an exact number, 'auto', or 'all' (default: auto)
(env: LLAMA_ARG_N_GPU_LAYERS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -sm | --split-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
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)"
            fi
            COMPREPLY=( $(compgen -W 'none layer row split' -- "$cur") )
            return 0
        ;;
        -ts | --tensor-split )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
fraction of the model to offload to each GPU, comma-separated list of proportions, e.g. 3,1
(env: LLAMA_ARG_TENSOR_SPLIT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -mg | --main-gpu )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fit | --fit )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
whether to adjust unset arguments to fit in device memory ('on' or 'off', default: 'on')
(env: LLAMA_ARG_FIT)"
            fi
            COMPREPLY=( $(compgen -W 'on off' -- "$cur") )
            return 0
        ;;
        -fitt | --fit-target )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fitc | --fit-ctx )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
minimum ctx size that can be set by --fit option, default: 4096
(env: LLAMA_ARG_FIT_CTX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --check-tensors )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
check model tensor data for invalid values (default: false)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --override-kv )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --op-offload )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to offload host tensor operations to device (default: true)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --lora )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to LoRA adapter (use comma-separated values to load multiple adapters)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --lora-scaled )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to LoRA adapter with user defined scaling (format: FNAME:SCALE,...)
note: use comma-separated values"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add a control vector
note: use comma-separated values to add multiple control vectors"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector-scaled )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add a control vector with user defined scaling SCALE
note: use comma-separated values (format: FNAME:SCALE,...)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector-layer-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
layer range to apply the control vector(s) to, start and end inclusive"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -m | --model )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
model path to load
(env: LLAMA_ARG_MODEL)"
            fi
            COMPREPLY=( $(compgen -f -X '!*.gguf' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -mu | --model-url )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
model download url (default: unused)
(env: LLAMA_ARG_MODEL_URL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -dr | --docker-repo )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Docker Hub model repository. repo is optional, default to ai/. quant is optional, default to :latest.
example: gemma3
(default: unused)
(env: LLAMA_ARG_DOCKER_REPO)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hf | -hfr | --hf-repo )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face model repository; quant is optional, case-insensitive, default to Q4_K_M, or falls back to the first file in the repo if Q4_K_M doesn't exist.
mmproj is also downloaded automatically if available. to disable, add --no-mmproj
example: ggml-org/GLM-4.7-Flash-GGUF:Q4_K_M
(default: unused)
(env: LLAMA_ARG_HF_REPO)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hff | --hf-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face model file. If specified, it will override the quant in --hf-repo (default: unused)
(env: LLAMA_ARG_HF_FILE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hft | --hf-token )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face access token (default: value from HF_TOKEN environment variable)
(env: HF_TOKEN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-disable )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log disable"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log to file
(env: LLAMA_ARG_LOG_FILE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-jsonl )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log as JSONL (one JSON object per line) to stdout, this also disables colored logging (default: disabled)
(env: LLAMA_ARG_LOG_JSONL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-colors )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
Set colored logging ('on', 'off', or 'auto', default: 'auto')
'auto' enables colors when output is to a terminal
(env: LLAMA_ARG_LOG_COLORS)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        -v | --verbose | --log-verbose )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Set verbosity level to infinity (i.e. log all messages, useful for debugging)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --offline )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Offline mode: forces use of cache, prevents network access
(env: LLAMA_ARG_OFFLINE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -lv | --verbosity | --log-verbosity )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Set the verbosity threshold. Messages with a higher verbosity will be ignored. Values:
 - 0: generic output
 - 1: error
 - 2: warning
 - 3: info
 - 4: trace (more info)
 - 5: debug
(default: 3)

(env: LLAMA_ARG_LOG_VERBOSITY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-prefix )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Enable prefix in log messages
(env: LLAMA_ARG_LOG_PREFIX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-timestamps )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Enable timestamps in log messages
(env: LLAMA_ARG_LOG_TIMESTAMPS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-type-k | -ctkd | --cache-type-k-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-type-v | -ctvd | --cache-type-v-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
KV cache data type for V 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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --samplers )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
samplers that will be used for generation in the order, separated by ';'
(default: penalties;dry;top_n_sigma;top_k;typ_p;top_p;min_p;xtc;temperature)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -s | --seed )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RNG seed (default: -1, use random seed for -1)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --sampler-seq | --sampling-seq )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
simplified sequence for samplers that will be used (default: edskypmxt)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --ignore-eos )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ignore end of stream token and continue generating (implies --logit-bias EOS-inf)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --temp | --temperature )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
temperature (default: 0.80)
(env: LLAMA_ARG_TEMPERATURE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-k )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-k sampling (default: 40, 0 = disabled)
(env: LLAMA_ARG_TOP_K)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-p sampling (default: 0.95, 1.0 = disabled)
(env: LLAMA_ARG_TOP_P)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --min-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
min-p sampling (default: 0.05, 0.0 = disabled)
(env: LLAMA_ARG_MIN_P)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-nsigma | --top-n-sigma )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-n-sigma sampling (default: -1.00, -1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --xtc-probability )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
xtc probability (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --xtc-threshold )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
xtc threshold (default: 0.10, 1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --typical | --typical-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
locally typical sampling, parameter p (default: 1.00, 1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repeat-last-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
last n tokens to consider for penalize (default: 64, 0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repeat-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
penalize repeat sequence of tokens (default: 1.00, 1.0 = disabled)
(env: LLAMA_ARG_REPEAT_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --presence-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
repeat alpha presence penalty (default: 0.00, 0.0 = disabled)
(env: LLAMA_ARG_PRESENCE_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --frequency-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
repeat alpha frequency penalty (default: 0.00, 0.0 = disabled)
(env: LLAMA_ARG_FREQUENCY_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-multiplier )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY sampling multiplier (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-base )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY sampling base value (default: 1.75)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-allowed-length )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set allowed length for DRY sampling (default: 2)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-penalty-last-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY penalty for the last n tokens (default: 64, 0 = disable)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-sequence-breaker )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add sequence breaker for DRY sampling, clearing out default breakers ('\\n', ':', '\"', '*') in the process; use \"none\" to not use any sequence breakers
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --adaptive-target )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
adaptive-p: select tokens near this probability (valid range 0.0 to 1.0; negative = disabled) (default: -1.00)
[(more info)](https://github.com/ggml-org/llama.cpp/pull/17927)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --adaptive-decay )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
adaptive-p: 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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dynatemp-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
dynamic temperature range (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dynatemp-exp )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
dynamic temperature exponent (default: 1.00)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use Mirostat sampling.
Top K, Nucleus and Locally Typical samplers are ignored if used.
(default: 0, 0 = disabled, 1 = Mirostat, 2 = Mirostat 2.0)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat-lr )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Mirostat learning rate, parameter eta (default: 0.10)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat-ent )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Mirostat target entropy, parameter tau (default: 5.00)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -l | --logit-bias )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
modifies the likelihood of token appearing in the completion,
i.e. \`--logit-bias 15043+1\` to increase likelihood of token ' Hello',
or \`--logit-bias 15043-1\` to decrease likelihood of token ' Hello'"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --grammar )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
BNF-like grammar to constrain generations (see samples in grammars/ dir)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --grammar-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
file to read grammar from"
            fi
            COMPREPLY=( $(compgen -f -X '!*.gbnf' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -j | --json-schema )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
JSON schema to constrain generations (https://json-schema.org/), e.g. \`{\"type\": \"object\"}\` for any JSON object"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -jf | --json-schema-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
File containing a JSON schema to constrain generations (https://json-schema.org/), e.g. \`{\"type\": \"object\"}\` for any JSON object"
            fi
            COMPREPLY=( $(compgen -f -X '!*.json' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -bs | --backend-sampling )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
enable backend sampling (experimental) (default: disabled)
(env: LLAMA_ARG_BACKEND_SAMPLING)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --verbose-prompt )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print a verbose prompt before generation (default: false)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --chunks )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
max number of chunks to process (default: -1, -1 = all)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --warmup )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to perform warmup with an empty run (default: enabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --pooling )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
pooling type for embeddings, use model default if unspecified
(env: LLAMA_ARG_POOLING)"
            fi
            COMPREPLY=( $(compgen -W 'none mean cls last rank' -- "$cur") )
            return 0
        ;;
        --context-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
file to load context from (use comma-separated values to specify multiple files)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --chunk-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
minimum length of embedded text chunks (default: 64)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --chunk-separator )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
separator between chunks (default: '
')"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
    esac

case "$curr" in
    -* )
        COMPREPLY=( $(compgen -W "${opts}" -- "$curr") )
        return 0
    ;;
esac
} && complete -F _comp_cmd_llama_retrieval llama-retrieval

_comp_cmd_llama_server()
{
    local curr prev opts
    COMPREPLY=()
    curr="${COMP_WORDS[COMP_CWORD]}"
    prev="${COMP_WORDS[COMP_CWORD-1]}"

    opts="
        -h --help --usage
        --version
        -cl --cache-list
        --completion-bash
        -t --threads
        -tb --threads-batch
        -C --cpu-mask
        -Cr --cpu-range
        --cpu-strict
        --prio
        --poll
        -Cb --cpu-mask-batch
        -Crb --cpu-range-batch
        --cpu-strict-batch
        --prio-batch
        --poll-batch
        -c --ctx-size
        -n --predict --n-predict
        -b --batch-size
        -ub --ubatch-size
        --keep
        --swa-full
        -fa --flash-attn
        --perf
        -e --escape
        --rope-scaling
        --rope-scale
        --rope-freq-base
        --rope-freq-scale
        --yarn-orig-ctx
        --yarn-ext-factor
        --yarn-attn-factor
        --yarn-beta-slow
        --yarn-beta-fast
        -kvo --kv-offload
        --repack
        --no-host
        -ctk --cache-type-k
        -ctv --cache-type-v
        -dt --defrag-thold
        --rpc
        -lm --load-mode
        -lzm --lazy-mode
        --numa
        -dev --device
        --list-devices
        -ot --override-tensor
        -cmoe --cpu-moe
        -ncmoe --n-cpu-moe
        --moe-cache-mib
        -ncffn --n-cpu-ffn
        -ngl --gpu-layers --n-gpu-layers
        -sm --split-mode
        -ts --tensor-split
        -mg --main-gpu
        -fit --fit
        -fitt --fit-target
        -fitc --fit-ctx
        --check-tensors
        --override-kv
        --op-offload
        --lora
        --lora-scaled
        --control-vector
        --control-vector-scaled
        --control-vector-layer-range
        -m --model
        -mu --model-url
        -dr --docker-repo
        -hf -hfr --hf-repo
        -hff --hf-file
        -hft --hf-token
        --log-disable
        --log-file
        --log-jsonl
        --log-colors
        -v --verbose --log-verbose
        --offline
        -lv --verbosity --log-verbosity
        --log-prefix
        --log-timestamps
        --spec-draft-type-k -ctkd --cache-type-k-draft
        --spec-draft-type-v -ctvd --cache-type-v-draft
        --samplers
        -s --seed
        --sampler-seq --sampling-seq
        --ignore-eos
        --temp --temperature
        --top-k
        --top-p
        --min-p
        --top-nsigma --top-n-sigma
        --xtc-probability
        --xtc-threshold
        --typical --typical-p
        --repeat-last-n
        --repeat-penalty
        --presence-penalty
        --frequency-penalty
        --dry-multiplier
        --dry-base
        --dry-allowed-length
        --dry-penalty-last-n
        --dry-sequence-breaker
        --adaptive-target
        --adaptive-decay
        --dynatemp-range
        --dynatemp-exp
        --mirostat
        --mirostat-lr
        --mirostat-ent
        -l --logit-bias
        --grammar
        --grammar-file
        -j --json-schema
        -jf --json-schema-file
        -bs --backend-sampling
        --spec-draft-hf -hfd -hfrd --hf-repo-draft
        --spec-draft-threads -td --threads-draft
        --spec-draft-threads-batch -tbd --threads-batch-draft
        --spec-draft-cpu-mask -Cd --cpu-mask-draft
        --spec-draft-cpu-range -Crd --cpu-range-draft
        --spec-draft-cpu-strict --cpu-strict-draft
        --spec-draft-prio --prio-draft
        --spec-draft-poll --poll-draft
        --spec-draft-cpu-mask-batch -Cbd --cpu-mask-batch-draft
        --spec-draft-cpu-strict-batch --cpu-strict-batch-draft
        --spec-draft-prio-batch --prio-batch-draft
        --spec-draft-poll-batch --poll-batch-draft
        --spec-draft-override-tensor -otd --override-tensor-draft
        --spec-draft-cpu-moe -cmoed --cpu-moe-draft
        --spec-draft-n-cpu-moe --spec-draft-ncmoe -ncmoed --n-cpu-moe-draft
        --spec-draft-n-max
        --spec-draft-n-min
        --spec-draft-n-ubatch
        --spec-synth-len
        --spec-synth-rates
        --spec-draft-p-split --draft-p-split
        --spec-draft-p-min --draft-p-min
        --spec-draft-backend-sampling
        --spec-draft-sampling
        --spec-draft-device -devd --device-draft
        --spec-draft-ngl -ngld --gpu-layers-draft --n-gpu-layers-draft
        --spec-draft-model -md --model-draft
        --spec-type
        --spec-ngram-mod-n-min
        --spec-ngram-mod-n-max
        --spec-ngram-mod-n-match
        --spec-ngram-simple-size-n
        --spec-ngram-simple-size-m
        --spec-ngram-simple-min-hits
        --spec-ngram-map-k-size-n
        --spec-ngram-map-k-size-m
        --spec-ngram-map-k-min-hits
        --spec-ngram-map-k4v-size-n
        --spec-ngram-map-k4v-size-m
        --spec-ngram-map-k4v-min-hits
        --draft --draft-n --draft-max
        --draft-min --draft-n-min
        --spec-ngram-size-n
        --spec-ngram-size-m
        --spec-ngram-min-hits
        -lcs --lookup-cache-static
        -lcd --lookup-cache-dynamic
        --kv-unified-per-slot
        -ctxcp --ctx-checkpoints --swa-checkpoints
        -cms --checkpoint-min-step
        -cram --cache-ram
        -kvu --kv-unified
        --cache-idle-slots
        --context-shift
        -r --reverse-prompt
        -sp --special
        --warmup
        --spm-infill
        --pooling
        -np --parallel
        -cb --cont-batching
        -mm --mmproj
        -mmu --mmproj-url
        --mmproj-auto
        --mmproj-offload
        -mmdev --mmproj-device
        --image-min-tokens
        --image-max-tokens
        --mtmd-batch-max-tokens
        --video-fps
        --video-timestamp-interval
        --video-ffmpeg-dir
        -a --alias
        --tags
        --embd-normalize
        --host
        --port
        --reuse-port
        --path
        --cors-origins
        --cors-methods
        --cors-headers
        --cors-credentials
        --api-prefix
        --ui-config --webui-config
        --ui-config-file --webui-config-file
        --ui-mcp-proxy --webui-mcp-proxy
        --tools
        --tools-runtime
        --mcp-servers-config
        --mcp-servers-json
        -ag --agent
        --ui --webui
        --connect
        --connect-code
        --embedding --embeddings
        --rerank --reranking
        --api-key
        --api-key-file
        --ssl-key-file
        --ssl-cert-file
        --chat-template-kwargs
        -to --timeout
        --sse-ping-interval
        --threads-http
        --cache-prompt
        --cache-reuse
        --metrics
        --props
        --slots
        --slot-save-path
        --media-path
        --models-dir
        --models-preset
        --models-max
        --models-memory-margin
        --models-autoload
        --jinja
        --reasoning-format
        -rea --reasoning
        --reasoning-effort
        --reasoning-budget
        --reasoning-budget-message
        --reasoning-preserve
        --chat-template
        --chat-template-file
        --skip-chat-parsing
        --prefill-assistant
        -sps --slot-prompt-similarity
        --lora-init-without-apply
        --sleep-idle-seconds
        --log-prompts-dir
        --embd-gemma-default
        --fim-qwen-1.5b-default
        --fim-qwen-3b-default
        --fim-qwen-7b-default
        --fim-qwen-7b-spec
        --fim-qwen-14b-spec
        --fim-qwen-30b-default
        --gpt-oss-20b-default
        --gpt-oss-120b-default
        --vision-gemma-4b-default
        --vision-gemma-12b-default
        --spec-default
    "

    case "$prev" in
        -h | --help | --usage )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print usage and exit"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --version )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
show version and build info"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -cl | --cache-list )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
show list of models in cache"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --completion-bash )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print source-able bash completion script for llama.cpp"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -t | --threads )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of CPU threads to use during generation (default: -1)
(env: LLAMA_ARG_THREADS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -tb | --threads-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of threads to use during batch and prompt processing (default: same as --threads)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -C | --cpu-mask )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
CPU affinity mask: arbitrarily long hex. Complements cpu-range (default: \"\")"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Cr | --cpu-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
range of CPUs for affinity. Complements --cpu-mask"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --cpu-strict )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use strict CPU placement (default: 0)
"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --prio )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set process/thread priority : low(-1), normal(0), medium(1), high(2), realtime(3) (default: 0)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --poll )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use polling level to wait for work (0 - no polling, default: 50)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Cb | --cpu-mask-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
CPU affinity mask: arbitrarily long hex. Complements cpu-range-batch (default: same as --cpu-mask)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Crb | --cpu-range-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ranges of CPUs for affinity. Complements --cpu-mask-batch"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --cpu-strict-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use strict CPU placement (default: same as --cpu-strict)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --prio-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set process/thread priority : 0-normal, 1-medium, 2-high, 3-realtime (default: 0)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --poll-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use polling to wait for work (default: same as --poll)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        -c | --ctx-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
size of the prompt context (default: 0, 0 = loaded from model)
(env: LLAMA_ARG_CTX_SIZE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -n | --predict | --n-predict )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of tokens to predict (default: -1, -1 = infinity)
(env: LLAMA_ARG_N_PREDICT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -b | --batch-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
logical maximum batch size (default: 2048)
(env: LLAMA_ARG_BATCH)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ub | --ubatch-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
physical maximum batch size (default: 512)
(env: LLAMA_ARG_UBATCH)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --keep )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of tokens to keep from the initial prompt (default: 0, -1 = all)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --swa-full )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fa | --flash-attn )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
set Flash Attention use ('on', 'off', or 'auto', default: 'auto')
(env: LLAMA_ARG_FLASH_ATTN)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        --perf )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable internal libllama performance timings (default: false)
(env: LLAMA_ARG_PERF)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -e | --escape )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to process escapes sequences (\\n, \\r, \\t, \\', \\\", \\\\) (default: true)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-scaling )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
RoPE frequency scaling method, defaults to linear unless specified by the model
(env: LLAMA_ARG_ROPE_SCALING_TYPE)"
            fi
            COMPREPLY=( $(compgen -W 'none linear yarn' -- "$cur") )
            return 0
        ;;
        --rope-scale )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE context scaling factor, expands context by a factor of N
(env: LLAMA_ARG_ROPE_SCALE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-freq-base )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE base frequency, used by NTK-aware scaling (default: loaded from model)
(env: LLAMA_ARG_ROPE_FREQ_BASE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-freq-scale )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE frequency scaling factor, expands context by a factor of 1/N
(env: LLAMA_ARG_ROPE_FREQ_SCALE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-orig-ctx )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: original context size of model (default: 0 = model training context size)
(env: LLAMA_ARG_YARN_ORIG_CTX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-ext-factor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: extrapolation mix factor (default: -1.00, 0.0 = full interpolation)
(env: LLAMA_ARG_YARN_EXT_FACTOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-attn-factor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: scale sqrt(t) or attention magnitude (default: -1.00)
(env: LLAMA_ARG_YARN_ATTN_FACTOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-beta-slow )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: high correction dim or alpha (default: -1.00)
(env: LLAMA_ARG_YARN_BETA_SLOW)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-beta-fast )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: low correction dim or beta (default: -1.00)
(env: LLAMA_ARG_YARN_BETA_FAST)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -kvo | --kv-offload )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable KV cache offloading (default: enabled)
(env: LLAMA_ARG_KV_OFFLOAD)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repack )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable weight repacking (default: enabled)
(env: LLAMA_ARG_REPACK)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --no-host )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
bypass host buffer allowing extra buffers to be used
(env: LLAMA_ARG_NO_HOST)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ctk | --cache-type-k )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ctv | --cache-type-v )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -dt | --defrag-thold )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
KV cache defragmentation threshold (DEPRECATED)
(env: LLAMA_ARG_DEFRAG_THOLD)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rpc )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
comma-separated list of RPC servers (host:port)
(env: LLAMA_ARG_RPC)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -lm | --load-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
model loading mode (default: auto)
- 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)"
            fi
            COMPREPLY=( $(compgen -W 'auto none mmap mlock mmap+mlock dio' -- "$cur") )
            return 0
        ;;
        -lzm | --lazy-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
on-demand reading of certain tensors, for example per-layer embeddings (default: auto)
- on: read the rows of such tensors from disk on demand instead of keeping them resident (requires mmap)
- auto: on, but only for tensors larger than 4 GiB
- off: always keep them resident
(env: LLAMA_ARG_LAZY_MODE)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        --numa )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
attempt optimizations that help on some NUMA systems
- 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)"
            fi
            COMPREPLY=( $(compgen -W 'distribute isolate numactl' -- "$cur") )
            return 0
        ;;
        -dev | --device )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --list-devices )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print list of available devices and exit"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ot | --override-tensor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
override tensor buffer type
(env: LLAMA_ARG_OVERRIDE_TENSOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -cmoe | --cpu-moe )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep all Mixture of Experts (MoE) weights in the CPU
(env: LLAMA_ARG_CPU_MOE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ncmoe | --n-cpu-moe )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep the Mixture of Experts (MoE) weights of the first N layers in the CPU
(env: LLAMA_ARG_N_CPU_MOE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --moe-cache-mib )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
GPU cache size in MiB for the MoE experts kept in the CPU. with multiple GPUs, it is split among them like the layers (--tensor-split) (default: 0, disabled)
(env: LLAMA_ARG_MOE_CACHE_MIB)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ncffn | --n-cpu-ffn )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep the dense FFN weights of the first N layers in the CPU
(dense models; for MoE expert weights use --n-cpu-moe)
(env: LLAMA_ARG_N_CPU_FFN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ngl | --gpu-layers | --n-gpu-layers )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
max. number of layers to store in VRAM, either an exact number, 'auto', or 'all' (default: auto)
(env: LLAMA_ARG_N_GPU_LAYERS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -sm | --split-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
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)"
            fi
            COMPREPLY=( $(compgen -W 'none layer row split' -- "$cur") )
            return 0
        ;;
        -ts | --tensor-split )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
fraction of the model to offload to each GPU, comma-separated list of proportions, e.g. 3,1
(env: LLAMA_ARG_TENSOR_SPLIT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -mg | --main-gpu )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fit | --fit )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
whether to adjust unset arguments to fit in device memory ('on' or 'off', default: 'on')
(env: LLAMA_ARG_FIT)"
            fi
            COMPREPLY=( $(compgen -W 'on off' -- "$cur") )
            return 0
        ;;
        -fitt | --fit-target )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fitc | --fit-ctx )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
minimum ctx size that can be set by --fit option, default: 4096
(env: LLAMA_ARG_FIT_CTX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --check-tensors )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
check model tensor data for invalid values (default: false)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --override-kv )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --op-offload )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to offload host tensor operations to device (default: true)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --lora )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to LoRA adapter (use comma-separated values to load multiple adapters)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --lora-scaled )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to LoRA adapter with user defined scaling (format: FNAME:SCALE,...)
note: use comma-separated values"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add a control vector
note: use comma-separated values to add multiple control vectors"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector-scaled )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add a control vector with user defined scaling SCALE
note: use comma-separated values (format: FNAME:SCALE,...)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector-layer-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
layer range to apply the control vector(s) to, start and end inclusive"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -m | --model )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
model path to load
(env: LLAMA_ARG_MODEL)"
            fi
            COMPREPLY=( $(compgen -f -X '!*.gguf' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -mu | --model-url )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
model download url (default: unused)
(env: LLAMA_ARG_MODEL_URL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -dr | --docker-repo )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Docker Hub model repository. repo is optional, default to ai/. quant is optional, default to :latest.
example: gemma3
(default: unused)
(env: LLAMA_ARG_DOCKER_REPO)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hf | -hfr | --hf-repo )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face model repository; quant is optional, case-insensitive, default to Q4_K_M, or falls back to the first file in the repo if Q4_K_M doesn't exist.
mmproj is also downloaded automatically if available. to disable, add --no-mmproj
example: ggml-org/GLM-4.7-Flash-GGUF:Q4_K_M
(default: unused)
(env: LLAMA_ARG_HF_REPO)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hff | --hf-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face model file. If specified, it will override the quant in --hf-repo (default: unused)
(env: LLAMA_ARG_HF_FILE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hft | --hf-token )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face access token (default: value from HF_TOKEN environment variable)
(env: HF_TOKEN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-disable )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log disable"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log to file
(env: LLAMA_ARG_LOG_FILE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-jsonl )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log as JSONL (one JSON object per line) to stdout, this also disables colored logging (default: disabled)
(env: LLAMA_ARG_LOG_JSONL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-colors )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
Set colored logging ('on', 'off', or 'auto', default: 'auto')
'auto' enables colors when output is to a terminal
(env: LLAMA_ARG_LOG_COLORS)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        -v | --verbose | --log-verbose )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Set verbosity level to infinity (i.e. log all messages, useful for debugging)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --offline )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Offline mode: forces use of cache, prevents network access
(env: LLAMA_ARG_OFFLINE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -lv | --verbosity | --log-verbosity )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Set the verbosity threshold. Messages with a higher verbosity will be ignored. Values:
 - 0: generic output
 - 1: error
 - 2: warning
 - 3: info
 - 4: trace (more info)
 - 5: debug
(default: 3)

(env: LLAMA_ARG_LOG_VERBOSITY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-prefix )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Enable prefix in log messages
(env: LLAMA_ARG_LOG_PREFIX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-timestamps )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Enable timestamps in log messages
(env: LLAMA_ARG_LOG_TIMESTAMPS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-type-k | -ctkd | --cache-type-k-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-type-v | -ctvd | --cache-type-v-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
KV cache data type for V 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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --samplers )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
samplers that will be used for generation in the order, separated by ';'
(default: penalties;dry;top_n_sigma;top_k;typ_p;top_p;min_p;xtc;temperature)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -s | --seed )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RNG seed (default: -1, use random seed for -1)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --sampler-seq | --sampling-seq )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
simplified sequence for samplers that will be used (default: edskypmxt)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --ignore-eos )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ignore end of stream token and continue generating (implies --logit-bias EOS-inf)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --temp | --temperature )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
temperature (default: 0.80)
(env: LLAMA_ARG_TEMPERATURE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-k )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-k sampling (default: 40, 0 = disabled)
(env: LLAMA_ARG_TOP_K)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-p sampling (default: 0.95, 1.0 = disabled)
(env: LLAMA_ARG_TOP_P)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --min-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
min-p sampling (default: 0.05, 0.0 = disabled)
(env: LLAMA_ARG_MIN_P)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-nsigma | --top-n-sigma )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-n-sigma sampling (default: -1.00, -1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --xtc-probability )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
xtc probability (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --xtc-threshold )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
xtc threshold (default: 0.10, 1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --typical | --typical-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
locally typical sampling, parameter p (default: 1.00, 1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repeat-last-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
last n tokens to consider for penalize (default: 64, 0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repeat-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
penalize repeat sequence of tokens (default: 1.00, 1.0 = disabled)
(env: LLAMA_ARG_REPEAT_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --presence-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
repeat alpha presence penalty (default: 0.00, 0.0 = disabled)
(env: LLAMA_ARG_PRESENCE_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --frequency-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
repeat alpha frequency penalty (default: 0.00, 0.0 = disabled)
(env: LLAMA_ARG_FREQUENCY_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-multiplier )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY sampling multiplier (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-base )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY sampling base value (default: 1.75)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-allowed-length )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set allowed length for DRY sampling (default: 2)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-penalty-last-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY penalty for the last n tokens (default: 64, 0 = disable)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-sequence-breaker )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add sequence breaker for DRY sampling, clearing out default breakers ('\\n', ':', '\"', '*') in the process; use \"none\" to not use any sequence breakers
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --adaptive-target )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
adaptive-p: select tokens near this probability (valid range 0.0 to 1.0; negative = disabled) (default: -1.00)
[(more info)](https://github.com/ggml-org/llama.cpp/pull/17927)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --adaptive-decay )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
adaptive-p: 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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dynatemp-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
dynamic temperature range (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dynatemp-exp )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
dynamic temperature exponent (default: 1.00)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use Mirostat sampling.
Top K, Nucleus and Locally Typical samplers are ignored if used.
(default: 0, 0 = disabled, 1 = Mirostat, 2 = Mirostat 2.0)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat-lr )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Mirostat learning rate, parameter eta (default: 0.10)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat-ent )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Mirostat target entropy, parameter tau (default: 5.00)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -l | --logit-bias )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
modifies the likelihood of token appearing in the completion,
i.e. \`--logit-bias 15043+1\` to increase likelihood of token ' Hello',
or \`--logit-bias 15043-1\` to decrease likelihood of token ' Hello'"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --grammar )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
BNF-like grammar to constrain generations (see samples in grammars/ dir)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --grammar-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
file to read grammar from"
            fi
            COMPREPLY=( $(compgen -f -X '!*.gbnf' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -j | --json-schema )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
JSON schema to constrain generations (https://json-schema.org/), e.g. \`{\"type\": \"object\"}\` for any JSON object"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -jf | --json-schema-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
File containing a JSON schema to constrain generations (https://json-schema.org/), e.g. \`{\"type\": \"object\"}\` for any JSON object"
            fi
            COMPREPLY=( $(compgen -f -X '!*.json' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -bs | --backend-sampling )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
enable backend sampling (experimental) (default: disabled)
(env: LLAMA_ARG_BACKEND_SAMPLING)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-hf | -hfd | -hfrd | --hf-repo-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Same as --hf-repo, but for the draft model (default: unused)
(env: LLAMA_ARG_SPEC_DRAFT_HF_REPO)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-threads | -td | --threads-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of threads to use during generation (default: same as --threads)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-threads-batch | -tbd | --threads-batch-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of threads to use during batch and prompt processing (default: same as --threads-draft)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-cpu-mask | -Cd | --cpu-mask-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Draft model CPU affinity mask. Complements cpu-range-draft (default: same as --cpu-mask)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-cpu-range | -Crd | --cpu-range-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Ranges of CPUs for affinity. Complements --cpu-mask-draft"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-cpu-strict | --cpu-strict-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
Use strict CPU placement for draft model (default: same as --cpu-strict)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --spec-draft-prio | --prio-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set draft process/thread priority : 0-normal, 1-medium, 2-high, 3-realtime (default: 0)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-poll | --poll-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
Use polling to wait for draft model work (default: same as --poll)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --spec-draft-cpu-mask-batch | -Cbd | --cpu-mask-batch-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Draft model CPU affinity mask. Complements cpu-range-draft (default: same as --cpu-mask)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-cpu-strict-batch | --cpu-strict-batch-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
Use strict CPU placement for draft model (default: --cpu-strict-draft)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --spec-draft-prio-batch | --prio-batch-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set draft process/thread priority : 0-normal, 1-medium, 2-high, 3-realtime (default: 0)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-poll-batch | --poll-batch-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
Use polling to wait for draft model work (default: --poll-draft)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --spec-draft-override-tensor | -otd | --override-tensor-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
override tensor buffer type for draft model"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-cpu-moe | -cmoed | --cpu-moe-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep all Mixture of Experts (MoE) weights in the CPU for the draft model
(env: LLAMA_ARG_SPEC_DRAFT_CPU_MOE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-n-cpu-moe | --spec-draft-ncmoe | -ncmoed | --n-cpu-moe-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep the Mixture of Experts (MoE) weights of the first N layers in the CPU for the draft model
(env: LLAMA_ARG_SPEC_DRAFT_N_CPU_MOE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-n-max )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of tokens to draft for speculative decoding (default: 3)
(env: LLAMA_ARG_SPEC_DRAFT_N_MAX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-n-min )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
minimum number of draft tokens to use for speculative decoding (default: 0)
(env: LLAMA_ARG_SPEC_DRAFT_N_MIN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-n-ubatch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
physical maximum batch size of the draft context, use a smaller value to spare VRAM (default: 0 - same as --n-ubatch)
(env: LLAMA_ARG_SPEC_DRAFT_N_UBATCH)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-synth-len )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
target mean synthetic acceptance length, including the target token (benchmarking only)
(env: LLAMA_ARG_SPEC_SYNTH_LEN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-synth-rates )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
comma-separated unconditional per-position synthetic acceptance probabilities (benchmarking only)
(env: LLAMA_ARG_SPEC_SYNTH_RATES)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-p-split | --draft-p-split )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
speculative decoding split probability (default: 0.10)
(env: LLAMA_ARG_SPEC_DRAFT_P_SPLIT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-p-min | --draft-p-min )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
minimum speculative decoding probability (greedy) (default: 0.00)
(env: LLAMA_ARG_SPEC_DRAFT_P_MIN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-backend-sampling )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
offload draft sampling to the backend (default: enabled)
(env: LLAMA_ARG_SPEC_DRAFT_BACKEND_SAMPLING)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-sampling )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
how the draft is sampled: greedy takes its argmax, probabilistic samples it and has the target verify by rejection sampling (default: greedy)
(env: LLAMA_ARG_SPEC_DRAFT_SAMPLING)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-device | -devd | --device-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
comma-separated list of devices to use for offloading the draft model (none = don't offload, default: follows --device)
use --list-devices to see a list of available devices"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-ngl | -ngld | --gpu-layers-draft | --n-gpu-layers-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
max. number of draft model layers to store in VRAM, either an exact number, 'auto', or 'all' (default: auto)
(env: LLAMA_ARG_N_GPU_LAYERS_DRAFT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-model | -md | --model-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
draft model for speculative decoding (default: unused)
(env: LLAMA_ARG_SPEC_DRAFT_MODEL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-type )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
comma-separated list of types of speculative decoding to use (default: none)

(env: LLAMA_ARG_SPEC_TYPE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-ngram-mod-n-min )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
minimum number of ngram tokens to use for ngram-based speculative decoding (default: 48)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-ngram-mod-n-max )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
maximum number of ngram tokens to use for ngram-based speculative decoding (default: 64)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-ngram-mod-n-match )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ngram-mod lookup length (default: 24)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-ngram-simple-size-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ngram size N for ngram-simple speculative decoding, length of lookup n-gram (default: 12)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-ngram-simple-size-m )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ngram size M for ngram-simple speculative decoding, length of draft m-gram (default: 48)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-ngram-simple-min-hits )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
minimum hits for ngram-simple speculative decoding (default: 1)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-ngram-map-k-size-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ngram size N for ngram-map-k speculative decoding, length of lookup n-gram (default: 12)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-ngram-map-k-size-m )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ngram size M for ngram-map-k speculative decoding, length of draft m-gram (default: 48)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-ngram-map-k-min-hits )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
minimum hits for ngram-map-k speculative decoding (default: 1)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-ngram-map-k4v-size-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ngram size N for ngram-map-k4v speculative decoding, length of lookup n-gram (default: 12)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-ngram-map-k4v-size-m )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ngram size M for ngram-map-k4v speculative decoding, length of draft m-gram (default: 48)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-ngram-map-k4v-min-hits )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
minimum hits for ngram-map-k4v speculative decoding (default: 1)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --draft | --draft-n | --draft-max )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
the argument has been removed. use --spec-draft-n-max or --spec-ngram-mod-n-max
(env: LLAMA_ARG_DRAFT_MAX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --draft-min | --draft-n-min )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
the argument has been removed. use --spec-draft-n-min or --spec-ngram-mod-n-min
(env: LLAMA_ARG_DRAFT_MIN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-ngram-size-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
the argument has been removed. use the respective --spec-ngram-*-size-n or --spec-ngram-mod-n-match"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-ngram-size-m )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
the argument has been removed. use the respective --spec-ngram-*-size-m"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-ngram-min-hits )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
the argument has been removed. use the respective --spec-ngram-*-min-hits"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -lcs | --lookup-cache-static )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to static lookup cache to use for lookup decoding (not updated by generation)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -lcd | --lookup-cache-dynamic )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to dynamic lookup cache to use for lookup decoding (updated by generation)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --kv-unified-per-slot )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
context limit per parallel slot (default: unset, behavior unchanged).
when set without -c/--ctx-size, the shared KV pool is sized to n_parallel*N
(env: LLAMA_ARG_KV_UNIFIED_PER_SLOT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ctxcp | --ctx-checkpoints | --swa-checkpoints )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
max number of context checkpoints to create per slot (default: 32)[(more info)](https://github.com/ggml-org/llama.cpp/pull/15293)
(env: LLAMA_ARG_CTX_CHECKPOINTS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -cms | --checkpoint-min-step )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
minimum spacing between context checkpoints in tokens (default: 8192, 0 = no minimum)
(env: LLAMA_ARG_CHECKPOINT_MIN_SPACING_NT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -cram | --cache-ram )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set the maximum cache size in MiB (default: 8192, 0 for decision models, -1 - no limit, 0 - disable)[(more info)](https://github.com/ggml-org/llama.cpp/pull/16391)
(env: LLAMA_ARG_CACHE_RAM)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -kvu | --kv-unified )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use single unified KV buffer shared across all sequences (default: enabled if number of slots is auto)
(env: LLAMA_ARG_KV_UNIFIED)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --cache-idle-slots )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
save idle slots to the prompt cache on new task, and clear them when using unified KV (default: enabled, requires cache-ram)
(env: LLAMA_ARG_CACHE_IDLE_SLOTS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --context-shift )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to use context shift on infinite text generation (default: disabled)
(env: LLAMA_ARG_CONTEXT_SHIFT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -r | --reverse-prompt )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
halt generation at PROMPT, return control in interactive mode
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -sp | --special )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
special tokens output enabled (default: false)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --warmup )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to perform warmup with an empty run (default: enabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spm-infill )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use Suffix/Prefix/Middle pattern for infill (instead of Prefix/Suffix/Middle) as some models prefer this. (default: disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --pooling )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
pooling type for embeddings, use model default if unspecified
(env: LLAMA_ARG_POOLING)"
            fi
            COMPREPLY=( $(compgen -W 'none mean cls last rank' -- "$cur") )
            return 0
        ;;
        -np | --parallel )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of server slots (default: -1, -1 = auto)
(env: LLAMA_ARG_N_PARALLEL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -cb | --cont-batching )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable continuous batching (a.k.a dynamic batching) (default: enabled)
(env: LLAMA_ARG_CONT_BATCHING)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -mm | --mmproj )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
path to a multimodal projector file. see tools/mtmd/README.md
note: if -hf is used, this argument can be omitted
(env: LLAMA_ARG_MMPROJ)"
            fi
            COMPREPLY=( $(compgen -f -X '!*.mmproj' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -mmu | --mmproj-url )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
URL to a multimodal projector file. see tools/mtmd/README.md
(env: LLAMA_ARG_MMPROJ_URL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mmproj-auto )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to use multimodal projector file (if available), useful when using -hf (default: enabled)
(env: LLAMA_ARG_MMPROJ_AUTO)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mmproj-offload )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable GPU offloading for multimodal projector (default: enabled)
(env: LLAMA_ARG_MMPROJ_OFFLOAD)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -mmdev | --mmproj-device )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
device to use for multimodal projector (none = don't offload, default: follows --device)
use --list-devices to see a list of available devices
(env: MTMD_BACKEND_DEVICE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --image-min-tokens )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
minimum number of tokens each image can take, only used by vision models with dynamic resolution (default: read from model)
(env: LLAMA_ARG_IMAGE_MIN_TOKENS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --image-max-tokens )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
maximum number of tokens each image can take, only used by vision models with dynamic resolution (default: read from model)
(env: LLAMA_ARG_IMAGE_MAX_TOKENS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mtmd-batch-max-tokens )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
maximum number of image tokens per batch when encoding images (default: 1024)
(env: LLAMA_ARG_MTMD_BATCH_MAX_TOKENS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --video-fps )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
target video frame rate (default: 4.0)
(env: LLAMA_ARG_VIDEO_FPS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --video-timestamp-interval )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
interval in milliseconds between text timestamps (default: 5000)
(env: LLAMA_ARG_VIDEO_TIMESTAMP_INTERVAL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --video-ffmpeg-dir )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to the directory containing ffmpeg and ffprobe (default: search in PATH)
(env: LLAMA_ARG_VIDEO_FFMPEG_DIR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -a | --alias )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set model name aliases, comma-separated (to be used by API)
(env: LLAMA_ARG_ALIAS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --tags )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set model tags, comma-separated (informational, not used for routing)
(env: LLAMA_ARG_TAGS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --embd-normalize )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
normalisation for embeddings (default: 2) (-1=none, 0=max absolute int16, 1=taxicab, 2=euclidean, >2=p-norm)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --host )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
IP addresses to listen on, comma-separated, or UNIX socket paths ending in .sock; with multiple TCP addresses, :: binds IPv6 only; overlapping addresses result in undefined behavior (default: 127.0.0.1)
(env: LLAMA_ARG_HOST)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --port )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
port to listen (default: 9931)
(env: LLAMA_ARG_PORT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --reuse-port )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
allow multiple sockets to bind to the same port (default: disabled)
(env: LLAMA_ARG_REUSE_PORT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --path )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to serve static files from (default: )
(env: LLAMA_ARG_STATIC_PATH)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --cors-origins )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
comma-separated list of allowed origins for CORS (default: *)
if set to special value 'localhost', reflect the Origin header only if it is localhost
(env: LLAMA_ARG_CORS_ORIGINS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --cors-methods )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
comma-separated list of allowed methods for CORS (default: GET, POST, DELETE, OPTIONS)
(env: LLAMA_ARG_CORS_METHODS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --cors-headers )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
comma-separated list of allowed headers for CORS (default: *)
(env: LLAMA_ARG_CORS_HEADERS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --cors-credentials )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to allow credentials for CORS (default: enabled)
note: if this is enabled and --cors-origins is set to * (default), the Origin header will be echoed back, and credentials will always be allowed
(env: LLAMA_ARG_CORS_CREDENTIALS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --api-prefix )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
prefix path the server serves from, without the trailing slash (default: )
(env: LLAMA_ARG_API_PREFIX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --ui-config | --webui-config )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
JSON that provides default UI settings (overrides UI defaults)
(env: LLAMA_ARG_UI_CONFIG)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --ui-config-file | --webui-config-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
JSON file that provides default UI settings (overrides UI defaults)
(env: LLAMA_ARG_UI_CONFIG_FILE)"
            fi
            COMPREPLY=( $(compgen -f -X '!*.json' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        --ui-mcp-proxy | --webui-mcp-proxy )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
experimental: whether to enable MCP CORS proxy - do not enable in untrusted environments (default: disabled)
(env: LLAMA_ARG_UI_MCP_PROXY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --tools )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
experimental: whether to enable built-in tools for AI agents - do not enable in untrusted environments (default: no tools)
specify \"all\" to enable all tools
available tools: read_file, file_glob_search, grep_search, exec_shell_command, write_file, edit_file, get_info
note: for security reasons, this will limit --cors-origins to localhost by default
(env: LLAMA_ARG_TOOLS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --tools-runtime )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
experimental: run tools in a separate runtime environment (default: none, use host environment)
available options:
  'docker:<image>', 'podman:<image>': spin up a new container and reuse it for all invocations, clean up on server exit
  'docker-container:<id>', 'podman-container:<id>': use an existing container by ID, won't stop on server exit
  'ssh:<target>': run tools on a remote POSIX host over SSH, key-based auth and a trusted host key are required

(env: LLAMA_ARG_TOOLS_RUNTIME)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mcp-servers-config )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
experimental: path to JSON file with MCP server definitions (Cursor-compatible format) - do not enable in untrusted environments (default: none)
note: for security reasons, this will limit --cors-origins to localhost by default
(env: LLAMA_ARG_MCP_SERVERS_CONFIG)"
            fi
            COMPREPLY=( $(compgen -f -X '!*.json' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        --mcp-servers-json )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
experimental: inline JSON with MCP server definitions (Cursor-compatible format) - do not enable in untrusted environments (default: none)
note: for security reasons, this will limit --cors-origins to localhost by default
(env: LLAMA_ARG_MCP_SERVERS_JSON)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ag | --agent )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable CORS proxy and all built-in tools - do not enable in untrusted environments (default: disabled)
note: for security reasons, this will limit --cors-origins to localhost by default
(env: LLAMA_ARG_AGENT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --ui | --webui )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable the Web UI (default: enabled)
(env: LLAMA_ARG_UI)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --connect )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
(experimental) open a peer-to-peer tunnel for server using llama-connect (default: disabled)
(env: LLAMA_ARG_CONNECT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --connect-code )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
manually specify a 40-character code for --connect (default: generate a new one for each run)
(env: LLAMA_ARG_CONNECT_CODE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --embedding | --embeddings )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
restrict to only support embedding use case; use only with dedicated embedding models (default: disabled)
(env: LLAMA_ARG_EMBEDDINGS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rerank | --reranking )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
enable reranking endpoint on server (default: disabled)
(env: LLAMA_ARG_RERANKING)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --api-key )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
API key to use for authentication, multiple keys can be provided as a comma-separated list (default: none)
(env: LLAMA_API_KEY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --api-key-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to file containing API keys, one per line; lines starting with a hash are treated as comments (default: none)
(env: LLAMA_ARG_API_KEY_FILE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --ssl-key-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to file a PEM-encoded SSL private key
(env: LLAMA_ARG_SSL_KEY_FILE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --ssl-cert-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to file a PEM-encoded SSL certificate
(env: LLAMA_ARG_SSL_CERT_FILE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --chat-template-kwargs )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
sets additional params for the json template parser, must be a valid json object string, e.g. '{\"key1\":\"value1\",\"key2\":\"value2\"}'
(env: LLAMA_ARG_CHAT_TEMPLATE_KWARGS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -to | --timeout )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
server read/write timeout in seconds (default: 3600)
(env: LLAMA_ARG_TIMEOUT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --sse-ping-interval )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
server SSE ping interval in seconds (-1 = disabled, default: 30)
(env: LLAMA_ARG_SSE_PING_INTERVAL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --threads-http )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of threads used to process HTTP requests (default: -1)
(env: LLAMA_ARG_THREADS_HTTP)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --cache-prompt )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable prompt caching (default: enabled)
(env: LLAMA_ARG_CACHE_PROMPT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --cache-reuse )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
min chunk size to attempt reusing from the cache via KV shifting, requires prompt caching to be enabled (default: 0)
[(card)](https://ggml.ai/f0.png)
(env: LLAMA_ARG_CACHE_REUSE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --metrics )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
enable prometheus compatible metrics endpoint (default: disabled)
(env: LLAMA_ARG_ENDPOINT_METRICS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --props )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
enable changing global properties via POST /props (default: disabled)
(env: LLAMA_ARG_ENDPOINT_PROPS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --slots )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
expose slots monitoring endpoint (default: enabled)
(env: LLAMA_ARG_ENDPOINT_SLOTS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --slot-save-path )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to save slot kv cache (default: disabled)
(env: LLAMA_ARG_SLOT_SAVE_PATH)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --media-path )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
directory for loading local media files; files can be accessed via file:// URLs using relative paths (default: disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --models-dir )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
directory containing models for the router server (default: disabled)
(env: LLAMA_ARG_MODELS_DIR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --models-preset )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to INI file containing model presets for the router server (default: disabled)
(env: LLAMA_ARG_MODELS_PRESET)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --models-max )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
for router server, maximum number of models to load simultaneously (default: 4, 0 = unlimited)
(env: LLAMA_ARG_MODELS_MAX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --models-memory-margin )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
for router server, MiB of device memory to keep free per device, unload LRU models until a new one fits (default: 0, 0 = disabled)
(env: LLAMA_ARG_MODELS_MEMORY_MARGIN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --models-autoload )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
for router server, whether to automatically load models (default: enabled)
(env: LLAMA_ARG_MODELS_AUTOLOAD)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --jinja )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to use jinja template engine for chat (default: enabled)
(env: LLAMA_ARG_JINJA)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --reasoning-format )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
controls whether thought tags are allowed and/or extracted from the response, and in which format they're returned; one of:
- none: leaves thoughts unparsed in \`message.content\`
- deepseek: puts thoughts in \`message.reasoning_content\`
- deepseek-legacy: keeps \`<think>\` tags in \`message.content\` while also populating \`message.reasoning_content\`
(default: auto)
(env: LLAMA_ARG_THINK)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -rea | --reasoning )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Use reasoning/thinking in the chat ('on', 'off', or 'auto', default: 'auto' (detect from template))
(env: LLAMA_ARG_REASONING)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --reasoning-effort )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
reasoning effort level given to the chat template: 'default' to keep the template default,
or a level such as 'minimal', 'low', 'medium', 'high', 'xhigh' or 'max' (default: default)
(env: LLAMA_ARG_REASONING_EFFORT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --reasoning-budget )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
token budget for thinking: -1 for unrestricted, 0 for immediate end, N>0 for token budget (default: -1)
(env: LLAMA_ARG_THINK_BUDGET)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --reasoning-budget-message )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
message injected before the end-of-thinking tag when reasoning budget is exhausted (default: none)
(env: LLAMA_ARG_THINK_BUDGET_MESSAGE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --reasoning-preserve )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
preserve reasoning trace in the full history, not just the last assistant message (default: enabled)
compatible with certain templates having 'supports_preserve_reasoning' capability
example: https://docs.z.ai/guides/capabilities/thinking-mode#preserved-thinking
(env: LLAMA_ARG_REASONING_PRESERVE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --chat-template )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set custom jinja chat template (default: template taken from model's metadata)
if suffix/prefix are specified, template will be disabled
only commonly used templates are accepted (unless --jinja is set before this flag):
list of built-in templates:
bailing, bailing-think, bailing2, chatglm3, chatglm4, chatml, command-r, deepseek, deepseek-ocr, deepseek2, deepseek3, exaone-moe, exaone3, exaone4, falcon3, gemma, gigachat, glmedge, gpt-oss, granite, granite-4.0, granite-4.1, grok-2, hunyuan-dense, hunyuan-moe, hunyuan-vl, kimi-k2, llama2, llama2-sys, llama2-sys-bos, llama2-sys-strip, llama3, llama4, megrez, minicpm, mistral-v1, mistral-v3, mistral-v3-tekken, mistral-v7, mistral-v7-tekken, monarch, openchat, orion, pangu-embedded, phi3, phi4, rwkv-world, seed_oss, smolvlm, solar-open, vicuna, vicuna-orca, yandex, zephyr
(env: LLAMA_ARG_CHAT_TEMPLATE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --chat-template-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
set custom jinja chat template file (default: template taken from model's metadata)
if suffix/prefix are specified, template will be disabled
only commonly used templates are accepted (unless --jinja is set before this flag):
list of built-in templates:
bailing, bailing-think, bailing2, chatglm3, chatglm4, chatml, command-r, deepseek, deepseek-ocr, deepseek2, deepseek3, exaone-moe, exaone3, exaone4, falcon3, gemma, gigachat, glmedge, gpt-oss, granite, granite-4.0, granite-4.1, grok-2, hunyuan-dense, hunyuan-moe, hunyuan-vl, kimi-k2, llama2, llama2-sys, llama2-sys-bos, llama2-sys-strip, llama3, llama4, megrez, minicpm, mistral-v1, mistral-v3, mistral-v3-tekken, mistral-v7, mistral-v7-tekken, monarch, openchat, orion, pangu-embedded, phi3, phi4, rwkv-world, seed_oss, smolvlm, solar-open, vicuna, vicuna-orca, yandex, zephyr
(env: LLAMA_ARG_CHAT_TEMPLATE_FILE)"
            fi
            COMPREPLY=( $(compgen -f -X '!*.jinja' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        --skip-chat-parsing )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
force a pure content parser, even if a Jinja template is specified; model will output everything in the content section, including any reasoning and/or tool calls (default: disabled)
(env: LLAMA_ARG_SKIP_CHAT_PARSING)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --prefill-assistant )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to prefill the assistant's response if the last message is an assistant message (default: prefill enabled)
when this flag is set, if the last message is an assistant message then it will be treated as a full message and not prefilled

(env: LLAMA_ARG_PREFILL_ASSISTANT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -sps | --slot-prompt-similarity )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
how much the prompt of a request must match the prompt of a slot in order to use that slot (default: 0.10, 0.0 = disabled)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --lora-init-without-apply )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
load LoRA adapters without applying them (apply later via POST /lora-adapters) (default: disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --sleep-idle-seconds )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of seconds of idleness after which the server will sleep (default: -1; -1 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-prompts-dir )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
Log prompts to directory (auto-created if not present; only used for debugging, default: disabled)"
            fi
            COMPREPLY=( $(compgen -d -- "$cur") )
            return 0
        ;;
        --embd-gemma-default )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use default EmbeddingGemma model (note: can download weights from the internet)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --fim-qwen-1.5b-default )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use default Qwen 2.5 Coder 1.5B (note: can download weights from the internet)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --fim-qwen-3b-default )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use default Qwen 2.5 Coder 3B (note: can download weights from the internet)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --fim-qwen-7b-default )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use default Qwen 2.5 Coder 7B (note: can download weights from the internet)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --fim-qwen-7b-spec )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use Qwen 2.5 Coder 7B + 0.5B draft for speculative decoding (note: can download weights from the internet)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --fim-qwen-14b-spec )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use Qwen 2.5 Coder 14B + 0.5B draft for speculative decoding (note: can download weights from the internet)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --fim-qwen-30b-default )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use default Qwen 3 Coder 30B A3B Instruct (note: can download weights from the internet)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --gpt-oss-20b-default )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use gpt-oss-20b (note: can download weights from the internet)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --gpt-oss-120b-default )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use gpt-oss-120b (note: can download weights from the internet)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --vision-gemma-4b-default )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use Gemma 3 4B QAT (note: can download weights from the internet)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --vision-gemma-12b-default )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use Gemma 3 12B QAT (note: can download weights from the internet)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-default )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
enable default speculative decoding config"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
    esac

case "$curr" in
    -* )
        COMPREPLY=( $(compgen -W "${opts}" -- "$curr") )
        return 0
    ;;
esac
} && complete -F _comp_cmd_llama_server llama-server

_comp_cmd_llama_speculative()
{
    local curr prev opts
    COMPREPLY=()
    curr="${COMP_WORDS[COMP_CWORD]}"
    prev="${COMP_WORDS[COMP_CWORD-1]}"

    opts="
        -h --help --usage
        --version
        -cl --cache-list
        --completion-bash
        -t --threads
        -tb --threads-batch
        -C --cpu-mask
        -Cr --cpu-range
        --cpu-strict
        --prio
        --poll
        -Cb --cpu-mask-batch
        -Crb --cpu-range-batch
        --cpu-strict-batch
        --prio-batch
        --poll-batch
        -c --ctx-size
        -n --predict --n-predict
        -b --batch-size
        -ub --ubatch-size
        --keep
        --swa-full
        -fa --flash-attn
        -p --prompt
        --perf
        -f --file
        -bf --binary-file
        -e --escape
        --rope-scaling
        --rope-scale
        --rope-freq-base
        --rope-freq-scale
        --yarn-orig-ctx
        --yarn-ext-factor
        --yarn-attn-factor
        --yarn-beta-slow
        --yarn-beta-fast
        -kvo --kv-offload
        --repack
        --no-host
        -ctk --cache-type-k
        -ctv --cache-type-v
        -dt --defrag-thold
        -np --parallel
        --rpc
        -lm --load-mode
        -lzm --lazy-mode
        --numa
        -dev --device
        --list-devices
        -ot --override-tensor
        -cmoe --cpu-moe
        -ncmoe --n-cpu-moe
        --moe-cache-mib
        -ncffn --n-cpu-ffn
        -ngl --gpu-layers --n-gpu-layers
        -sm --split-mode
        -ts --tensor-split
        -mg --main-gpu
        -fit --fit
        -fitt --fit-target
        -fitc --fit-ctx
        --check-tensors
        --override-kv
        --op-offload
        --lora
        --lora-scaled
        --control-vector
        --control-vector-scaled
        --control-vector-layer-range
        -m --model
        -mu --model-url
        -dr --docker-repo
        -hf -hfr --hf-repo
        -hff --hf-file
        -hft --hf-token
        --log-disable
        --log-file
        --log-jsonl
        --log-colors
        -v --verbose --log-verbose
        --offline
        -lv --verbosity --log-verbosity
        --log-prefix
        --log-timestamps
        --spec-draft-type-k -ctkd --cache-type-k-draft
        --spec-draft-type-v -ctvd --cache-type-v-draft
        --samplers
        -s --seed
        --sampler-seq --sampling-seq
        --ignore-eos
        --temp --temperature
        --top-k
        --top-p
        --min-p
        --top-nsigma --top-n-sigma
        --xtc-probability
        --xtc-threshold
        --typical --typical-p
        --repeat-last-n
        --repeat-penalty
        --presence-penalty
        --frequency-penalty
        --dry-multiplier
        --dry-base
        --dry-allowed-length
        --dry-penalty-last-n
        --dry-sequence-breaker
        --adaptive-target
        --adaptive-decay
        --dynatemp-range
        --dynatemp-exp
        --mirostat
        --mirostat-lr
        --mirostat-ent
        -l --logit-bias
        --grammar
        --grammar-file
        -j --json-schema
        -jf --json-schema-file
        -bs --backend-sampling
        --spec-draft-hf -hfd -hfrd --hf-repo-draft
        --spec-draft-threads -td --threads-draft
        --spec-draft-threads-batch -tbd --threads-batch-draft
        --spec-draft-cpu-mask -Cd --cpu-mask-draft
        --spec-draft-cpu-range -Crd --cpu-range-draft
        --spec-draft-cpu-strict --cpu-strict-draft
        --spec-draft-prio --prio-draft
        --spec-draft-poll --poll-draft
        --spec-draft-cpu-mask-batch -Cbd --cpu-mask-batch-draft
        --spec-draft-cpu-range-batch -Crbd --cpu-range-batch-draft
        --spec-draft-cpu-strict-batch --cpu-strict-batch-draft
        --spec-draft-prio-batch --prio-batch-draft
        --spec-draft-poll-batch --poll-batch-draft
        --spec-draft-override-tensor -otd --override-tensor-draft
        --spec-draft-cpu-moe -cmoed --cpu-moe-draft
        --spec-draft-n-cpu-moe --spec-draft-ncmoe -ncmoed --n-cpu-moe-draft
        --spec-draft-n-max
        --spec-draft-n-min
        --spec-draft-n-ubatch
        --spec-draft-p-split --draft-p-split
        --spec-draft-p-min --draft-p-min
        --spec-draft-backend-sampling
        --spec-draft-sampling
        --spec-draft-device -devd --device-draft
        --spec-draft-ngl -ngld --gpu-layers-draft --n-gpu-layers-draft
        --spec-draft-model -md --model-draft
        --spec-type
        --spec-ngram-mod-n-min
        --spec-ngram-mod-n-max
        --spec-ngram-mod-n-match
        --spec-ngram-simple-size-n
        --spec-ngram-simple-size-m
        --spec-ngram-simple-min-hits
        --spec-ngram-map-k-size-n
        --spec-ngram-map-k-size-m
        --spec-ngram-map-k-min-hits
        --spec-ngram-map-k4v-size-n
        --spec-ngram-map-k4v-size-m
        --spec-ngram-map-k4v-min-hits
        --draft --draft-n --draft-max
        --draft-min --draft-n-min
        -co --color
        -kvu --kv-unified
    "

    case "$prev" in
        -h | --help | --usage )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print usage and exit"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --version )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
show version and build info"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -cl | --cache-list )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
show list of models in cache"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --completion-bash )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print source-able bash completion script for llama.cpp"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -t | --threads )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of CPU threads to use during generation (default: -1)
(env: LLAMA_ARG_THREADS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -tb | --threads-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of threads to use during batch and prompt processing (default: same as --threads)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -C | --cpu-mask )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
CPU affinity mask: arbitrarily long hex. Complements cpu-range (default: \"\")"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Cr | --cpu-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
range of CPUs for affinity. Complements --cpu-mask"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --cpu-strict )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use strict CPU placement (default: 0)
"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --prio )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set process/thread priority : low(-1), normal(0), medium(1), high(2), realtime(3) (default: 0)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --poll )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use polling level to wait for work (0 - no polling, default: 50)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Cb | --cpu-mask-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
CPU affinity mask: arbitrarily long hex. Complements cpu-range-batch (default: same as --cpu-mask)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Crb | --cpu-range-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ranges of CPUs for affinity. Complements --cpu-mask-batch"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --cpu-strict-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use strict CPU placement (default: same as --cpu-strict)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --prio-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set process/thread priority : 0-normal, 1-medium, 2-high, 3-realtime (default: 0)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --poll-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use polling to wait for work (default: same as --poll)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        -c | --ctx-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
size of the prompt context (default: 0, 0 = loaded from model)
(env: LLAMA_ARG_CTX_SIZE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -n | --predict | --n-predict )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of tokens to predict (default: -1, -1 = infinity)
(env: LLAMA_ARG_N_PREDICT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -b | --batch-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
logical maximum batch size (default: 2048)
(env: LLAMA_ARG_BATCH)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ub | --ubatch-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
physical maximum batch size (default: 512)
(env: LLAMA_ARG_UBATCH)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --keep )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of tokens to keep from the initial prompt (default: 0, -1 = all)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --swa-full )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fa | --flash-attn )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
set Flash Attention use ('on', 'off', or 'auto', default: 'auto')
(env: LLAMA_ARG_FLASH_ATTN)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        -p | --prompt )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
prompt to start generation with; for system message, use -sys"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --perf )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable internal libllama performance timings (default: false)
(env: LLAMA_ARG_PERF)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -f | --file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
a file containing the prompt (default: none)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -bf | --binary-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
binary file containing the prompt (default: none)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -e | --escape )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to process escapes sequences (\\n, \\r, \\t, \\', \\\", \\\\) (default: true)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-scaling )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
RoPE frequency scaling method, defaults to linear unless specified by the model
(env: LLAMA_ARG_ROPE_SCALING_TYPE)"
            fi
            COMPREPLY=( $(compgen -W 'none linear yarn' -- "$cur") )
            return 0
        ;;
        --rope-scale )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE context scaling factor, expands context by a factor of N
(env: LLAMA_ARG_ROPE_SCALE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-freq-base )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE base frequency, used by NTK-aware scaling (default: loaded from model)
(env: LLAMA_ARG_ROPE_FREQ_BASE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-freq-scale )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE frequency scaling factor, expands context by a factor of 1/N
(env: LLAMA_ARG_ROPE_FREQ_SCALE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-orig-ctx )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: original context size of model (default: 0 = model training context size)
(env: LLAMA_ARG_YARN_ORIG_CTX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-ext-factor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: extrapolation mix factor (default: -1.00, 0.0 = full interpolation)
(env: LLAMA_ARG_YARN_EXT_FACTOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-attn-factor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: scale sqrt(t) or attention magnitude (default: -1.00)
(env: LLAMA_ARG_YARN_ATTN_FACTOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-beta-slow )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: high correction dim or alpha (default: -1.00)
(env: LLAMA_ARG_YARN_BETA_SLOW)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-beta-fast )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: low correction dim or beta (default: -1.00)
(env: LLAMA_ARG_YARN_BETA_FAST)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -kvo | --kv-offload )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable KV cache offloading (default: enabled)
(env: LLAMA_ARG_KV_OFFLOAD)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repack )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable weight repacking (default: enabled)
(env: LLAMA_ARG_REPACK)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --no-host )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
bypass host buffer allowing extra buffers to be used
(env: LLAMA_ARG_NO_HOST)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ctk | --cache-type-k )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ctv | --cache-type-v )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -dt | --defrag-thold )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
KV cache defragmentation threshold (DEPRECATED)
(env: LLAMA_ARG_DEFRAG_THOLD)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -np | --parallel )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of parallel sequences to decode (default: 1)
(env: LLAMA_ARG_N_PARALLEL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rpc )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
comma-separated list of RPC servers (host:port)
(env: LLAMA_ARG_RPC)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -lm | --load-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
model loading mode (default: auto)
- 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)"
            fi
            COMPREPLY=( $(compgen -W 'auto none mmap mlock mmap+mlock dio' -- "$cur") )
            return 0
        ;;
        -lzm | --lazy-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
on-demand reading of certain tensors, for example per-layer embeddings (default: auto)
- on: read the rows of such tensors from disk on demand instead of keeping them resident (requires mmap)
- auto: on, but only for tensors larger than 4 GiB
- off: always keep them resident
(env: LLAMA_ARG_LAZY_MODE)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        --numa )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
attempt optimizations that help on some NUMA systems
- 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)"
            fi
            COMPREPLY=( $(compgen -W 'distribute isolate numactl' -- "$cur") )
            return 0
        ;;
        -dev | --device )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --list-devices )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print list of available devices and exit"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ot | --override-tensor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
override tensor buffer type
(env: LLAMA_ARG_OVERRIDE_TENSOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -cmoe | --cpu-moe )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep all Mixture of Experts (MoE) weights in the CPU
(env: LLAMA_ARG_CPU_MOE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ncmoe | --n-cpu-moe )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep the Mixture of Experts (MoE) weights of the first N layers in the CPU
(env: LLAMA_ARG_N_CPU_MOE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --moe-cache-mib )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
GPU cache size in MiB for the MoE experts kept in the CPU. with multiple GPUs, it is split among them like the layers (--tensor-split) (default: 0, disabled)
(env: LLAMA_ARG_MOE_CACHE_MIB)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ncffn | --n-cpu-ffn )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep the dense FFN weights of the first N layers in the CPU
(dense models; for MoE expert weights use --n-cpu-moe)
(env: LLAMA_ARG_N_CPU_FFN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ngl | --gpu-layers | --n-gpu-layers )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
max. number of layers to store in VRAM, either an exact number, 'auto', or 'all' (default: auto)
(env: LLAMA_ARG_N_GPU_LAYERS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -sm | --split-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
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)"
            fi
            COMPREPLY=( $(compgen -W 'none layer row split' -- "$cur") )
            return 0
        ;;
        -ts | --tensor-split )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
fraction of the model to offload to each GPU, comma-separated list of proportions, e.g. 3,1
(env: LLAMA_ARG_TENSOR_SPLIT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -mg | --main-gpu )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fit | --fit )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
whether to adjust unset arguments to fit in device memory ('on' or 'off', default: 'on')
(env: LLAMA_ARG_FIT)"
            fi
            COMPREPLY=( $(compgen -W 'on off' -- "$cur") )
            return 0
        ;;
        -fitt | --fit-target )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fitc | --fit-ctx )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
minimum ctx size that can be set by --fit option, default: 4096
(env: LLAMA_ARG_FIT_CTX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --check-tensors )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
check model tensor data for invalid values (default: false)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --override-kv )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --op-offload )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to offload host tensor operations to device (default: true)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --lora )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to LoRA adapter (use comma-separated values to load multiple adapters)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --lora-scaled )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to LoRA adapter with user defined scaling (format: FNAME:SCALE,...)
note: use comma-separated values"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add a control vector
note: use comma-separated values to add multiple control vectors"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector-scaled )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add a control vector with user defined scaling SCALE
note: use comma-separated values (format: FNAME:SCALE,...)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector-layer-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
layer range to apply the control vector(s) to, start and end inclusive"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -m | --model )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
model path to load
(env: LLAMA_ARG_MODEL)"
            fi
            COMPREPLY=( $(compgen -f -X '!*.gguf' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -mu | --model-url )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
model download url (default: unused)
(env: LLAMA_ARG_MODEL_URL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -dr | --docker-repo )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Docker Hub model repository. repo is optional, default to ai/. quant is optional, default to :latest.
example: gemma3
(default: unused)
(env: LLAMA_ARG_DOCKER_REPO)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hf | -hfr | --hf-repo )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face model repository; quant is optional, case-insensitive, default to Q4_K_M, or falls back to the first file in the repo if Q4_K_M doesn't exist.
mmproj is also downloaded automatically if available. to disable, add --no-mmproj
example: ggml-org/GLM-4.7-Flash-GGUF:Q4_K_M
(default: unused)
(env: LLAMA_ARG_HF_REPO)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hff | --hf-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face model file. If specified, it will override the quant in --hf-repo (default: unused)
(env: LLAMA_ARG_HF_FILE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hft | --hf-token )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face access token (default: value from HF_TOKEN environment variable)
(env: HF_TOKEN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-disable )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log disable"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log to file
(env: LLAMA_ARG_LOG_FILE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-jsonl )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log as JSONL (one JSON object per line) to stdout, this also disables colored logging (default: disabled)
(env: LLAMA_ARG_LOG_JSONL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-colors )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
Set colored logging ('on', 'off', or 'auto', default: 'auto')
'auto' enables colors when output is to a terminal
(env: LLAMA_ARG_LOG_COLORS)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        -v | --verbose | --log-verbose )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Set verbosity level to infinity (i.e. log all messages, useful for debugging)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --offline )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Offline mode: forces use of cache, prevents network access
(env: LLAMA_ARG_OFFLINE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -lv | --verbosity | --log-verbosity )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Set the verbosity threshold. Messages with a higher verbosity will be ignored. Values:
 - 0: generic output
 - 1: error
 - 2: warning
 - 3: info
 - 4: trace (more info)
 - 5: debug
(default: 3)

(env: LLAMA_ARG_LOG_VERBOSITY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-prefix )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Enable prefix in log messages
(env: LLAMA_ARG_LOG_PREFIX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-timestamps )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Enable timestamps in log messages
(env: LLAMA_ARG_LOG_TIMESTAMPS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-type-k | -ctkd | --cache-type-k-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-type-v | -ctvd | --cache-type-v-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
KV cache data type for V 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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --samplers )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
samplers that will be used for generation in the order, separated by ';'
(default: penalties;dry;top_n_sigma;top_k;typ_p;top_p;min_p;xtc;temperature)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -s | --seed )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RNG seed (default: -1, use random seed for -1)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --sampler-seq | --sampling-seq )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
simplified sequence for samplers that will be used (default: edskypmxt)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --ignore-eos )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ignore end of stream token and continue generating (implies --logit-bias EOS-inf)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --temp | --temperature )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
temperature (default: 0.80)
(env: LLAMA_ARG_TEMPERATURE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-k )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-k sampling (default: 40, 0 = disabled)
(env: LLAMA_ARG_TOP_K)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-p sampling (default: 0.95, 1.0 = disabled)
(env: LLAMA_ARG_TOP_P)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --min-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
min-p sampling (default: 0.05, 0.0 = disabled)
(env: LLAMA_ARG_MIN_P)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-nsigma | --top-n-sigma )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-n-sigma sampling (default: -1.00, -1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --xtc-probability )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
xtc probability (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --xtc-threshold )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
xtc threshold (default: 0.10, 1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --typical | --typical-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
locally typical sampling, parameter p (default: 1.00, 1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repeat-last-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
last n tokens to consider for penalize (default: 64, 0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repeat-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
penalize repeat sequence of tokens (default: 1.00, 1.0 = disabled)
(env: LLAMA_ARG_REPEAT_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --presence-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
repeat alpha presence penalty (default: 0.00, 0.0 = disabled)
(env: LLAMA_ARG_PRESENCE_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --frequency-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
repeat alpha frequency penalty (default: 0.00, 0.0 = disabled)
(env: LLAMA_ARG_FREQUENCY_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-multiplier )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY sampling multiplier (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-base )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY sampling base value (default: 1.75)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-allowed-length )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set allowed length for DRY sampling (default: 2)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-penalty-last-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY penalty for the last n tokens (default: 64, 0 = disable)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-sequence-breaker )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add sequence breaker for DRY sampling, clearing out default breakers ('\\n', ':', '\"', '*') in the process; use \"none\" to not use any sequence breakers
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --adaptive-target )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
adaptive-p: select tokens near this probability (valid range 0.0 to 1.0; negative = disabled) (default: -1.00)
[(more info)](https://github.com/ggml-org/llama.cpp/pull/17927)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --adaptive-decay )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
adaptive-p: 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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dynatemp-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
dynamic temperature range (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dynatemp-exp )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
dynamic temperature exponent (default: 1.00)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use Mirostat sampling.
Top K, Nucleus and Locally Typical samplers are ignored if used.
(default: 0, 0 = disabled, 1 = Mirostat, 2 = Mirostat 2.0)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat-lr )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Mirostat learning rate, parameter eta (default: 0.10)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat-ent )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Mirostat target entropy, parameter tau (default: 5.00)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -l | --logit-bias )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
modifies the likelihood of token appearing in the completion,
i.e. \`--logit-bias 15043+1\` to increase likelihood of token ' Hello',
or \`--logit-bias 15043-1\` to decrease likelihood of token ' Hello'"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --grammar )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
BNF-like grammar to constrain generations (see samples in grammars/ dir)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --grammar-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
file to read grammar from"
            fi
            COMPREPLY=( $(compgen -f -X '!*.gbnf' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -j | --json-schema )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
JSON schema to constrain generations (https://json-schema.org/), e.g. \`{\"type\": \"object\"}\` for any JSON object"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -jf | --json-schema-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
File containing a JSON schema to constrain generations (https://json-schema.org/), e.g. \`{\"type\": \"object\"}\` for any JSON object"
            fi
            COMPREPLY=( $(compgen -f -X '!*.json' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -bs | --backend-sampling )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
enable backend sampling (experimental) (default: disabled)
(env: LLAMA_ARG_BACKEND_SAMPLING)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-hf | -hfd | -hfrd | --hf-repo-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Same as --hf-repo, but for the draft model (default: unused)
(env: LLAMA_ARG_SPEC_DRAFT_HF_REPO)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-threads | -td | --threads-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of threads to use during generation (default: same as --threads)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-threads-batch | -tbd | --threads-batch-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of threads to use during batch and prompt processing (default: same as --threads-draft)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-cpu-mask | -Cd | --cpu-mask-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Draft model CPU affinity mask. Complements cpu-range-draft (default: same as --cpu-mask)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-cpu-range | -Crd | --cpu-range-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Ranges of CPUs for affinity. Complements --cpu-mask-draft"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-cpu-strict | --cpu-strict-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
Use strict CPU placement for draft model (default: same as --cpu-strict)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --spec-draft-prio | --prio-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set draft process/thread priority : 0-normal, 1-medium, 2-high, 3-realtime (default: 0)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-poll | --poll-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
Use polling to wait for draft model work (default: same as --poll)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --spec-draft-cpu-mask-batch | -Cbd | --cpu-mask-batch-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Draft model CPU affinity mask. Complements cpu-range-draft (default: same as --cpu-mask)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-cpu-range-batch | -Crbd | --cpu-range-batch-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Ranges of CPUs for affinity. Complements --cpu-mask-draft-batch)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-cpu-strict-batch | --cpu-strict-batch-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
Use strict CPU placement for draft model (default: --cpu-strict-draft)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --spec-draft-prio-batch | --prio-batch-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set draft process/thread priority : 0-normal, 1-medium, 2-high, 3-realtime (default: 0)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-poll-batch | --poll-batch-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
Use polling to wait for draft model work (default: --poll-draft)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --spec-draft-override-tensor | -otd | --override-tensor-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
override tensor buffer type for draft model"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-cpu-moe | -cmoed | --cpu-moe-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep all Mixture of Experts (MoE) weights in the CPU for the draft model
(env: LLAMA_ARG_SPEC_DRAFT_CPU_MOE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-n-cpu-moe | --spec-draft-ncmoe | -ncmoed | --n-cpu-moe-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep the Mixture of Experts (MoE) weights of the first N layers in the CPU for the draft model
(env: LLAMA_ARG_SPEC_DRAFT_N_CPU_MOE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-n-max )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of tokens to draft for speculative decoding (default: 3)
(env: LLAMA_ARG_SPEC_DRAFT_N_MAX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-n-min )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
minimum number of draft tokens to use for speculative decoding (default: 0)
(env: LLAMA_ARG_SPEC_DRAFT_N_MIN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-n-ubatch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
physical maximum batch size of the draft context, use a smaller value to spare VRAM (default: 0 - same as --n-ubatch)
(env: LLAMA_ARG_SPEC_DRAFT_N_UBATCH)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-p-split | --draft-p-split )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
speculative decoding split probability (default: 0.10)
(env: LLAMA_ARG_SPEC_DRAFT_P_SPLIT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-p-min | --draft-p-min )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
minimum speculative decoding probability (greedy) (default: 0.00)
(env: LLAMA_ARG_SPEC_DRAFT_P_MIN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-backend-sampling )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
offload draft sampling to the backend (default: enabled)
(env: LLAMA_ARG_SPEC_DRAFT_BACKEND_SAMPLING)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-sampling )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
how the draft is sampled: greedy takes its argmax, probabilistic samples it and has the target verify by rejection sampling (default: greedy)
(env: LLAMA_ARG_SPEC_DRAFT_SAMPLING)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-device | -devd | --device-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
comma-separated list of devices to use for offloading the draft model (none = don't offload, default: follows --device)
use --list-devices to see a list of available devices"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-ngl | -ngld | --gpu-layers-draft | --n-gpu-layers-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
max. number of draft model layers to store in VRAM, either an exact number, 'auto', or 'all' (default: auto)
(env: LLAMA_ARG_N_GPU_LAYERS_DRAFT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-model | -md | --model-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
draft model for speculative decoding (default: unused)
(env: LLAMA_ARG_SPEC_DRAFT_MODEL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-type )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
comma-separated list of types of speculative decoding to use (default: none)

(env: LLAMA_ARG_SPEC_TYPE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-ngram-mod-n-min )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
minimum number of ngram tokens to use for ngram-based speculative decoding (default: 48)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-ngram-mod-n-max )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
maximum number of ngram tokens to use for ngram-based speculative decoding (default: 64)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-ngram-mod-n-match )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ngram-mod lookup length (default: 24)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-ngram-simple-size-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ngram size N for ngram-simple speculative decoding, length of lookup n-gram (default: 12)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-ngram-simple-size-m )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ngram size M for ngram-simple speculative decoding, length of draft m-gram (default: 48)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-ngram-simple-min-hits )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
minimum hits for ngram-simple speculative decoding (default: 1)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-ngram-map-k-size-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ngram size N for ngram-map-k speculative decoding, length of lookup n-gram (default: 12)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-ngram-map-k-size-m )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ngram size M for ngram-map-k speculative decoding, length of draft m-gram (default: 48)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-ngram-map-k-min-hits )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
minimum hits for ngram-map-k speculative decoding (default: 1)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-ngram-map-k4v-size-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ngram size N for ngram-map-k4v speculative decoding, length of lookup n-gram (default: 12)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-ngram-map-k4v-size-m )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ngram size M for ngram-map-k4v speculative decoding, length of draft m-gram (default: 48)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-ngram-map-k4v-min-hits )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
minimum hits for ngram-map-k4v speculative decoding (default: 1)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --draft | --draft-n | --draft-max )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
the argument has been removed. use --spec-draft-n-max or --spec-ngram-mod-n-max
(env: LLAMA_ARG_DRAFT_MAX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --draft-min | --draft-n-min )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
the argument has been removed. use --spec-draft-n-min or --spec-ngram-mod-n-min
(env: LLAMA_ARG_DRAFT_MIN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -co | --color )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
Colorize output to distinguish prompt and user input from generations ('on', 'off', or 'auto', default: 'auto')
'auto' enables colors when output is to a terminal"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        -kvu | --kv-unified )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use single unified KV buffer shared across all sequences (default: enabled if number of slots is auto)
(env: LLAMA_ARG_KV_UNIFIED)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
    esac

case "$curr" in
    -* )
        COMPREPLY=( $(compgen -W "${opts}" -- "$curr") )
        return 0
    ;;
esac
} && complete -F _comp_cmd_llama_speculative llama-speculative

_comp_cmd_llama_speculative_simple()
{
    local curr prev opts
    COMPREPLY=()
    curr="${COMP_WORDS[COMP_CWORD]}"
    prev="${COMP_WORDS[COMP_CWORD-1]}"

    opts="
        -h --help --usage
        --version
        -cl --cache-list
        --completion-bash
        -t --threads
        -tb --threads-batch
        -C --cpu-mask
        -Cr --cpu-range
        --cpu-strict
        --prio
        --poll
        -Cb --cpu-mask-batch
        -Crb --cpu-range-batch
        --cpu-strict-batch
        --prio-batch
        --poll-batch
        -c --ctx-size
        -n --predict --n-predict
        -b --batch-size
        -ub --ubatch-size
        --keep
        --swa-full
        -fa --flash-attn
        -p --prompt
        --perf
        -f --file
        -bf --binary-file
        -e --escape
        --rope-scaling
        --rope-scale
        --rope-freq-base
        --rope-freq-scale
        --yarn-orig-ctx
        --yarn-ext-factor
        --yarn-attn-factor
        --yarn-beta-slow
        --yarn-beta-fast
        -kvo --kv-offload
        --repack
        --no-host
        -ctk --cache-type-k
        -ctv --cache-type-v
        -dt --defrag-thold
        -np --parallel
        --rpc
        -lm --load-mode
        -lzm --lazy-mode
        --numa
        -dev --device
        --list-devices
        -ot --override-tensor
        -cmoe --cpu-moe
        -ncmoe --n-cpu-moe
        --moe-cache-mib
        -ncffn --n-cpu-ffn
        -ngl --gpu-layers --n-gpu-layers
        -sm --split-mode
        -ts --tensor-split
        -mg --main-gpu
        -fit --fit
        -fitt --fit-target
        -fitc --fit-ctx
        --check-tensors
        --override-kv
        --op-offload
        --lora
        --lora-scaled
        --control-vector
        --control-vector-scaled
        --control-vector-layer-range
        -m --model
        -mu --model-url
        -dr --docker-repo
        -hf -hfr --hf-repo
        -hff --hf-file
        -hft --hf-token
        --log-disable
        --log-file
        --log-jsonl
        --log-colors
        -v --verbose --log-verbose
        --offline
        -lv --verbosity --log-verbosity
        --log-prefix
        --log-timestamps
        --spec-draft-type-k -ctkd --cache-type-k-draft
        --spec-draft-type-v -ctvd --cache-type-v-draft
        --samplers
        -s --seed
        --sampler-seq --sampling-seq
        --ignore-eos
        --temp --temperature
        --top-k
        --top-p
        --min-p
        --top-nsigma --top-n-sigma
        --xtc-probability
        --xtc-threshold
        --typical --typical-p
        --repeat-last-n
        --repeat-penalty
        --presence-penalty
        --frequency-penalty
        --dry-multiplier
        --dry-base
        --dry-allowed-length
        --dry-penalty-last-n
        --dry-sequence-breaker
        --adaptive-target
        --adaptive-decay
        --dynatemp-range
        --dynatemp-exp
        --mirostat
        --mirostat-lr
        --mirostat-ent
        -l --logit-bias
        --grammar
        --grammar-file
        -j --json-schema
        -jf --json-schema-file
        -bs --backend-sampling
        --spec-draft-hf -hfd -hfrd --hf-repo-draft
        --spec-draft-threads -td --threads-draft
        --spec-draft-threads-batch -tbd --threads-batch-draft
        --spec-draft-cpu-mask -Cd --cpu-mask-draft
        --spec-draft-cpu-range -Crd --cpu-range-draft
        --spec-draft-cpu-strict --cpu-strict-draft
        --spec-draft-prio --prio-draft
        --spec-draft-poll --poll-draft
        --spec-draft-cpu-mask-batch -Cbd --cpu-mask-batch-draft
        --spec-draft-cpu-range-batch -Crbd --cpu-range-batch-draft
        --spec-draft-cpu-strict-batch --cpu-strict-batch-draft
        --spec-draft-prio-batch --prio-batch-draft
        --spec-draft-poll-batch --poll-batch-draft
        --spec-draft-override-tensor -otd --override-tensor-draft
        --spec-draft-cpu-moe -cmoed --cpu-moe-draft
        --spec-draft-n-cpu-moe --spec-draft-ncmoe -ncmoed --n-cpu-moe-draft
        --spec-draft-n-max
        --spec-draft-n-min
        --spec-draft-n-ubatch
        --spec-draft-p-split --draft-p-split
        --spec-draft-p-min --draft-p-min
        --spec-draft-backend-sampling
        --spec-draft-sampling
        --spec-draft-device -devd --device-draft
        --spec-draft-ngl -ngld --gpu-layers-draft --n-gpu-layers-draft
        --spec-draft-model -md --model-draft
        --spec-type
        --spec-ngram-mod-n-min
        --spec-ngram-mod-n-max
        --spec-ngram-mod-n-match
        --spec-ngram-simple-size-n
        --spec-ngram-simple-size-m
        --spec-ngram-simple-min-hits
        --spec-ngram-map-k-size-n
        --spec-ngram-map-k-size-m
        --spec-ngram-map-k-min-hits
        --spec-ngram-map-k4v-size-n
        --spec-ngram-map-k4v-size-m
        --spec-ngram-map-k4v-min-hits
        --draft --draft-n --draft-max
        --draft-min --draft-n-min
        -co --color
        -kvu --kv-unified
    "

    case "$prev" in
        -h | --help | --usage )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print usage and exit"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --version )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
show version and build info"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -cl | --cache-list )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
show list of models in cache"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --completion-bash )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print source-able bash completion script for llama.cpp"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -t | --threads )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of CPU threads to use during generation (default: -1)
(env: LLAMA_ARG_THREADS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -tb | --threads-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of threads to use during batch and prompt processing (default: same as --threads)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -C | --cpu-mask )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
CPU affinity mask: arbitrarily long hex. Complements cpu-range (default: \"\")"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Cr | --cpu-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
range of CPUs for affinity. Complements --cpu-mask"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --cpu-strict )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use strict CPU placement (default: 0)
"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --prio )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set process/thread priority : low(-1), normal(0), medium(1), high(2), realtime(3) (default: 0)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --poll )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use polling level to wait for work (0 - no polling, default: 50)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Cb | --cpu-mask-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
CPU affinity mask: arbitrarily long hex. Complements cpu-range-batch (default: same as --cpu-mask)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Crb | --cpu-range-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ranges of CPUs for affinity. Complements --cpu-mask-batch"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --cpu-strict-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use strict CPU placement (default: same as --cpu-strict)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --prio-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set process/thread priority : 0-normal, 1-medium, 2-high, 3-realtime (default: 0)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --poll-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use polling to wait for work (default: same as --poll)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        -c | --ctx-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
size of the prompt context (default: 0, 0 = loaded from model)
(env: LLAMA_ARG_CTX_SIZE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -n | --predict | --n-predict )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of tokens to predict (default: -1, -1 = infinity)
(env: LLAMA_ARG_N_PREDICT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -b | --batch-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
logical maximum batch size (default: 2048)
(env: LLAMA_ARG_BATCH)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ub | --ubatch-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
physical maximum batch size (default: 512)
(env: LLAMA_ARG_UBATCH)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --keep )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of tokens to keep from the initial prompt (default: 0, -1 = all)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --swa-full )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fa | --flash-attn )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
set Flash Attention use ('on', 'off', or 'auto', default: 'auto')
(env: LLAMA_ARG_FLASH_ATTN)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        -p | --prompt )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
prompt to start generation with; for system message, use -sys"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --perf )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable internal libllama performance timings (default: false)
(env: LLAMA_ARG_PERF)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -f | --file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
a file containing the prompt (default: none)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -bf | --binary-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
binary file containing the prompt (default: none)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -e | --escape )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to process escapes sequences (\\n, \\r, \\t, \\', \\\", \\\\) (default: true)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-scaling )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
RoPE frequency scaling method, defaults to linear unless specified by the model
(env: LLAMA_ARG_ROPE_SCALING_TYPE)"
            fi
            COMPREPLY=( $(compgen -W 'none linear yarn' -- "$cur") )
            return 0
        ;;
        --rope-scale )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE context scaling factor, expands context by a factor of N
(env: LLAMA_ARG_ROPE_SCALE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-freq-base )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE base frequency, used by NTK-aware scaling (default: loaded from model)
(env: LLAMA_ARG_ROPE_FREQ_BASE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-freq-scale )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE frequency scaling factor, expands context by a factor of 1/N
(env: LLAMA_ARG_ROPE_FREQ_SCALE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-orig-ctx )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: original context size of model (default: 0 = model training context size)
(env: LLAMA_ARG_YARN_ORIG_CTX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-ext-factor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: extrapolation mix factor (default: -1.00, 0.0 = full interpolation)
(env: LLAMA_ARG_YARN_EXT_FACTOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-attn-factor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: scale sqrt(t) or attention magnitude (default: -1.00)
(env: LLAMA_ARG_YARN_ATTN_FACTOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-beta-slow )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: high correction dim or alpha (default: -1.00)
(env: LLAMA_ARG_YARN_BETA_SLOW)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-beta-fast )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: low correction dim or beta (default: -1.00)
(env: LLAMA_ARG_YARN_BETA_FAST)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -kvo | --kv-offload )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable KV cache offloading (default: enabled)
(env: LLAMA_ARG_KV_OFFLOAD)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repack )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable weight repacking (default: enabled)
(env: LLAMA_ARG_REPACK)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --no-host )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
bypass host buffer allowing extra buffers to be used
(env: LLAMA_ARG_NO_HOST)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ctk | --cache-type-k )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ctv | --cache-type-v )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -dt | --defrag-thold )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
KV cache defragmentation threshold (DEPRECATED)
(env: LLAMA_ARG_DEFRAG_THOLD)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -np | --parallel )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of parallel sequences to decode (default: 1)
(env: LLAMA_ARG_N_PARALLEL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rpc )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
comma-separated list of RPC servers (host:port)
(env: LLAMA_ARG_RPC)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -lm | --load-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
model loading mode (default: auto)
- 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)"
            fi
            COMPREPLY=( $(compgen -W 'auto none mmap mlock mmap+mlock dio' -- "$cur") )
            return 0
        ;;
        -lzm | --lazy-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
on-demand reading of certain tensors, for example per-layer embeddings (default: auto)
- on: read the rows of such tensors from disk on demand instead of keeping them resident (requires mmap)
- auto: on, but only for tensors larger than 4 GiB
- off: always keep them resident
(env: LLAMA_ARG_LAZY_MODE)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        --numa )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
attempt optimizations that help on some NUMA systems
- 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)"
            fi
            COMPREPLY=( $(compgen -W 'distribute isolate numactl' -- "$cur") )
            return 0
        ;;
        -dev | --device )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --list-devices )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print list of available devices and exit"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ot | --override-tensor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
override tensor buffer type
(env: LLAMA_ARG_OVERRIDE_TENSOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -cmoe | --cpu-moe )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep all Mixture of Experts (MoE) weights in the CPU
(env: LLAMA_ARG_CPU_MOE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ncmoe | --n-cpu-moe )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep the Mixture of Experts (MoE) weights of the first N layers in the CPU
(env: LLAMA_ARG_N_CPU_MOE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --moe-cache-mib )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
GPU cache size in MiB for the MoE experts kept in the CPU. with multiple GPUs, it is split among them like the layers (--tensor-split) (default: 0, disabled)
(env: LLAMA_ARG_MOE_CACHE_MIB)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ncffn | --n-cpu-ffn )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep the dense FFN weights of the first N layers in the CPU
(dense models; for MoE expert weights use --n-cpu-moe)
(env: LLAMA_ARG_N_CPU_FFN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ngl | --gpu-layers | --n-gpu-layers )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
max. number of layers to store in VRAM, either an exact number, 'auto', or 'all' (default: auto)
(env: LLAMA_ARG_N_GPU_LAYERS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -sm | --split-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
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)"
            fi
            COMPREPLY=( $(compgen -W 'none layer row split' -- "$cur") )
            return 0
        ;;
        -ts | --tensor-split )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
fraction of the model to offload to each GPU, comma-separated list of proportions, e.g. 3,1
(env: LLAMA_ARG_TENSOR_SPLIT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -mg | --main-gpu )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fit | --fit )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
whether to adjust unset arguments to fit in device memory ('on' or 'off', default: 'on')
(env: LLAMA_ARG_FIT)"
            fi
            COMPREPLY=( $(compgen -W 'on off' -- "$cur") )
            return 0
        ;;
        -fitt | --fit-target )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fitc | --fit-ctx )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
minimum ctx size that can be set by --fit option, default: 4096
(env: LLAMA_ARG_FIT_CTX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --check-tensors )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
check model tensor data for invalid values (default: false)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --override-kv )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --op-offload )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to offload host tensor operations to device (default: true)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --lora )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to LoRA adapter (use comma-separated values to load multiple adapters)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --lora-scaled )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to LoRA adapter with user defined scaling (format: FNAME:SCALE,...)
note: use comma-separated values"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add a control vector
note: use comma-separated values to add multiple control vectors"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector-scaled )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add a control vector with user defined scaling SCALE
note: use comma-separated values (format: FNAME:SCALE,...)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector-layer-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
layer range to apply the control vector(s) to, start and end inclusive"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -m | --model )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
model path to load
(env: LLAMA_ARG_MODEL)"
            fi
            COMPREPLY=( $(compgen -f -X '!*.gguf' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -mu | --model-url )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
model download url (default: unused)
(env: LLAMA_ARG_MODEL_URL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -dr | --docker-repo )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Docker Hub model repository. repo is optional, default to ai/. quant is optional, default to :latest.
example: gemma3
(default: unused)
(env: LLAMA_ARG_DOCKER_REPO)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hf | -hfr | --hf-repo )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face model repository; quant is optional, case-insensitive, default to Q4_K_M, or falls back to the first file in the repo if Q4_K_M doesn't exist.
mmproj is also downloaded automatically if available. to disable, add --no-mmproj
example: ggml-org/GLM-4.7-Flash-GGUF:Q4_K_M
(default: unused)
(env: LLAMA_ARG_HF_REPO)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hff | --hf-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face model file. If specified, it will override the quant in --hf-repo (default: unused)
(env: LLAMA_ARG_HF_FILE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hft | --hf-token )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face access token (default: value from HF_TOKEN environment variable)
(env: HF_TOKEN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-disable )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log disable"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log to file
(env: LLAMA_ARG_LOG_FILE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-jsonl )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log as JSONL (one JSON object per line) to stdout, this also disables colored logging (default: disabled)
(env: LLAMA_ARG_LOG_JSONL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-colors )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
Set colored logging ('on', 'off', or 'auto', default: 'auto')
'auto' enables colors when output is to a terminal
(env: LLAMA_ARG_LOG_COLORS)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        -v | --verbose | --log-verbose )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Set verbosity level to infinity (i.e. log all messages, useful for debugging)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --offline )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Offline mode: forces use of cache, prevents network access
(env: LLAMA_ARG_OFFLINE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -lv | --verbosity | --log-verbosity )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Set the verbosity threshold. Messages with a higher verbosity will be ignored. Values:
 - 0: generic output
 - 1: error
 - 2: warning
 - 3: info
 - 4: trace (more info)
 - 5: debug
(default: 3)

(env: LLAMA_ARG_LOG_VERBOSITY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-prefix )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Enable prefix in log messages
(env: LLAMA_ARG_LOG_PREFIX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-timestamps )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Enable timestamps in log messages
(env: LLAMA_ARG_LOG_TIMESTAMPS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-type-k | -ctkd | --cache-type-k-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-type-v | -ctvd | --cache-type-v-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
KV cache data type for V 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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --samplers )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
samplers that will be used for generation in the order, separated by ';'
(default: penalties;dry;top_n_sigma;top_k;typ_p;top_p;min_p;xtc;temperature)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -s | --seed )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RNG seed (default: -1, use random seed for -1)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --sampler-seq | --sampling-seq )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
simplified sequence for samplers that will be used (default: edskypmxt)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --ignore-eos )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ignore end of stream token and continue generating (implies --logit-bias EOS-inf)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --temp | --temperature )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
temperature (default: 0.80)
(env: LLAMA_ARG_TEMPERATURE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-k )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-k sampling (default: 40, 0 = disabled)
(env: LLAMA_ARG_TOP_K)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-p sampling (default: 0.95, 1.0 = disabled)
(env: LLAMA_ARG_TOP_P)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --min-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
min-p sampling (default: 0.05, 0.0 = disabled)
(env: LLAMA_ARG_MIN_P)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-nsigma | --top-n-sigma )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-n-sigma sampling (default: -1.00, -1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --xtc-probability )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
xtc probability (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --xtc-threshold )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
xtc threshold (default: 0.10, 1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --typical | --typical-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
locally typical sampling, parameter p (default: 1.00, 1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repeat-last-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
last n tokens to consider for penalize (default: 64, 0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repeat-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
penalize repeat sequence of tokens (default: 1.00, 1.0 = disabled)
(env: LLAMA_ARG_REPEAT_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --presence-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
repeat alpha presence penalty (default: 0.00, 0.0 = disabled)
(env: LLAMA_ARG_PRESENCE_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --frequency-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
repeat alpha frequency penalty (default: 0.00, 0.0 = disabled)
(env: LLAMA_ARG_FREQUENCY_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-multiplier )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY sampling multiplier (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-base )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY sampling base value (default: 1.75)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-allowed-length )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set allowed length for DRY sampling (default: 2)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-penalty-last-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY penalty for the last n tokens (default: 64, 0 = disable)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-sequence-breaker )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add sequence breaker for DRY sampling, clearing out default breakers ('\\n', ':', '\"', '*') in the process; use \"none\" to not use any sequence breakers
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --adaptive-target )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
adaptive-p: select tokens near this probability (valid range 0.0 to 1.0; negative = disabled) (default: -1.00)
[(more info)](https://github.com/ggml-org/llama.cpp/pull/17927)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --adaptive-decay )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
adaptive-p: 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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dynatemp-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
dynamic temperature range (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dynatemp-exp )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
dynamic temperature exponent (default: 1.00)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use Mirostat sampling.
Top K, Nucleus and Locally Typical samplers are ignored if used.
(default: 0, 0 = disabled, 1 = Mirostat, 2 = Mirostat 2.0)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat-lr )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Mirostat learning rate, parameter eta (default: 0.10)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat-ent )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Mirostat target entropy, parameter tau (default: 5.00)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -l | --logit-bias )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
modifies the likelihood of token appearing in the completion,
i.e. \`--logit-bias 15043+1\` to increase likelihood of token ' Hello',
or \`--logit-bias 15043-1\` to decrease likelihood of token ' Hello'"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --grammar )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
BNF-like grammar to constrain generations (see samples in grammars/ dir)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --grammar-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
file to read grammar from"
            fi
            COMPREPLY=( $(compgen -f -X '!*.gbnf' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -j | --json-schema )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
JSON schema to constrain generations (https://json-schema.org/), e.g. \`{\"type\": \"object\"}\` for any JSON object"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -jf | --json-schema-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
File containing a JSON schema to constrain generations (https://json-schema.org/), e.g. \`{\"type\": \"object\"}\` for any JSON object"
            fi
            COMPREPLY=( $(compgen -f -X '!*.json' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -bs | --backend-sampling )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
enable backend sampling (experimental) (default: disabled)
(env: LLAMA_ARG_BACKEND_SAMPLING)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-hf | -hfd | -hfrd | --hf-repo-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Same as --hf-repo, but for the draft model (default: unused)
(env: LLAMA_ARG_SPEC_DRAFT_HF_REPO)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-threads | -td | --threads-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of threads to use during generation (default: same as --threads)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-threads-batch | -tbd | --threads-batch-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of threads to use during batch and prompt processing (default: same as --threads-draft)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-cpu-mask | -Cd | --cpu-mask-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Draft model CPU affinity mask. Complements cpu-range-draft (default: same as --cpu-mask)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-cpu-range | -Crd | --cpu-range-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Ranges of CPUs for affinity. Complements --cpu-mask-draft"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-cpu-strict | --cpu-strict-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
Use strict CPU placement for draft model (default: same as --cpu-strict)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --spec-draft-prio | --prio-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set draft process/thread priority : 0-normal, 1-medium, 2-high, 3-realtime (default: 0)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-poll | --poll-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
Use polling to wait for draft model work (default: same as --poll)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --spec-draft-cpu-mask-batch | -Cbd | --cpu-mask-batch-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Draft model CPU affinity mask. Complements cpu-range-draft (default: same as --cpu-mask)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-cpu-range-batch | -Crbd | --cpu-range-batch-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Ranges of CPUs for affinity. Complements --cpu-mask-draft-batch)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-cpu-strict-batch | --cpu-strict-batch-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
Use strict CPU placement for draft model (default: --cpu-strict-draft)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --spec-draft-prio-batch | --prio-batch-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set draft process/thread priority : 0-normal, 1-medium, 2-high, 3-realtime (default: 0)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-poll-batch | --poll-batch-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
Use polling to wait for draft model work (default: --poll-draft)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --spec-draft-override-tensor | -otd | --override-tensor-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
override tensor buffer type for draft model"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-cpu-moe | -cmoed | --cpu-moe-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep all Mixture of Experts (MoE) weights in the CPU for the draft model
(env: LLAMA_ARG_SPEC_DRAFT_CPU_MOE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-n-cpu-moe | --spec-draft-ncmoe | -ncmoed | --n-cpu-moe-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep the Mixture of Experts (MoE) weights of the first N layers in the CPU for the draft model
(env: LLAMA_ARG_SPEC_DRAFT_N_CPU_MOE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-n-max )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of tokens to draft for speculative decoding (default: 3)
(env: LLAMA_ARG_SPEC_DRAFT_N_MAX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-n-min )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
minimum number of draft tokens to use for speculative decoding (default: 0)
(env: LLAMA_ARG_SPEC_DRAFT_N_MIN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-n-ubatch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
physical maximum batch size of the draft context, use a smaller value to spare VRAM (default: 0 - same as --n-ubatch)
(env: LLAMA_ARG_SPEC_DRAFT_N_UBATCH)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-p-split | --draft-p-split )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
speculative decoding split probability (default: 0.10)
(env: LLAMA_ARG_SPEC_DRAFT_P_SPLIT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-p-min | --draft-p-min )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
minimum speculative decoding probability (greedy) (default: 0.00)
(env: LLAMA_ARG_SPEC_DRAFT_P_MIN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-backend-sampling )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
offload draft sampling to the backend (default: enabled)
(env: LLAMA_ARG_SPEC_DRAFT_BACKEND_SAMPLING)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-sampling )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
how the draft is sampled: greedy takes its argmax, probabilistic samples it and has the target verify by rejection sampling (default: greedy)
(env: LLAMA_ARG_SPEC_DRAFT_SAMPLING)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-device | -devd | --device-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
comma-separated list of devices to use for offloading the draft model (none = don't offload, default: follows --device)
use --list-devices to see a list of available devices"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-ngl | -ngld | --gpu-layers-draft | --n-gpu-layers-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
max. number of draft model layers to store in VRAM, either an exact number, 'auto', or 'all' (default: auto)
(env: LLAMA_ARG_N_GPU_LAYERS_DRAFT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-model | -md | --model-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
draft model for speculative decoding (default: unused)
(env: LLAMA_ARG_SPEC_DRAFT_MODEL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-type )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
comma-separated list of types of speculative decoding to use (default: none)

(env: LLAMA_ARG_SPEC_TYPE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-ngram-mod-n-min )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
minimum number of ngram tokens to use for ngram-based speculative decoding (default: 48)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-ngram-mod-n-max )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
maximum number of ngram tokens to use for ngram-based speculative decoding (default: 64)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-ngram-mod-n-match )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ngram-mod lookup length (default: 24)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-ngram-simple-size-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ngram size N for ngram-simple speculative decoding, length of lookup n-gram (default: 12)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-ngram-simple-size-m )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ngram size M for ngram-simple speculative decoding, length of draft m-gram (default: 48)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-ngram-simple-min-hits )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
minimum hits for ngram-simple speculative decoding (default: 1)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-ngram-map-k-size-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ngram size N for ngram-map-k speculative decoding, length of lookup n-gram (default: 12)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-ngram-map-k-size-m )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ngram size M for ngram-map-k speculative decoding, length of draft m-gram (default: 48)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-ngram-map-k-min-hits )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
minimum hits for ngram-map-k speculative decoding (default: 1)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-ngram-map-k4v-size-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ngram size N for ngram-map-k4v speculative decoding, length of lookup n-gram (default: 12)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-ngram-map-k4v-size-m )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ngram size M for ngram-map-k4v speculative decoding, length of draft m-gram (default: 48)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-ngram-map-k4v-min-hits )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
minimum hits for ngram-map-k4v speculative decoding (default: 1)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --draft | --draft-n | --draft-max )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
the argument has been removed. use --spec-draft-n-max or --spec-ngram-mod-n-max
(env: LLAMA_ARG_DRAFT_MAX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --draft-min | --draft-n-min )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
the argument has been removed. use --spec-draft-n-min or --spec-ngram-mod-n-min
(env: LLAMA_ARG_DRAFT_MIN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -co | --color )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
Colorize output to distinguish prompt and user input from generations ('on', 'off', or 'auto', default: 'auto')
'auto' enables colors when output is to a terminal"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        -kvu | --kv-unified )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use single unified KV buffer shared across all sequences (default: enabled if number of slots is auto)
(env: LLAMA_ARG_KV_UNIFIED)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
    esac

case "$curr" in
    -* )
        COMPREPLY=( $(compgen -W "${opts}" -- "$curr") )
        return 0
    ;;
esac
} && complete -F _comp_cmd_llama_speculative_simple llama-speculative-simple

_comp_cmd_llama_tokenize()
{
    local curr prev opts
    COMPREPLY=()
    curr="${COMP_WORDS[COMP_CWORD]}"
    prev="${COMP_WORDS[COMP_CWORD-1]}"

    opts="
        -h --help --usage
        --version
        -cl --cache-list
        --completion-bash
        -t --threads
        -tb --threads-batch
        -C --cpu-mask
        -Cr --cpu-range
        --cpu-strict
        --prio
        --poll
        -Cb --cpu-mask-batch
        -Crb --cpu-range-batch
        --cpu-strict-batch
        --prio-batch
        --poll-batch
        -c --ctx-size
        -n --predict --n-predict
        -b --batch-size
        -ub --ubatch-size
        --keep
        --swa-full
        -fa --flash-attn
        -p --prompt
        --perf
        -f --file
        -bf --binary-file
        -e --escape
        --rope-scaling
        --rope-scale
        --rope-freq-base
        --rope-freq-scale
        --yarn-orig-ctx
        --yarn-ext-factor
        --yarn-attn-factor
        --yarn-beta-slow
        --yarn-beta-fast
        -kvo --kv-offload
        --repack
        --no-host
        -ctk --cache-type-k
        -ctv --cache-type-v
        -dt --defrag-thold
        -np --parallel
        --rpc
        -lm --load-mode
        -lzm --lazy-mode
        --numa
        -dev --device
        --list-devices
        -ot --override-tensor
        -cmoe --cpu-moe
        -ncmoe --n-cpu-moe
        --moe-cache-mib
        -ncffn --n-cpu-ffn
        -ngl --gpu-layers --n-gpu-layers
        -sm --split-mode
        -ts --tensor-split
        -mg --main-gpu
        -fit --fit
        -fitt --fit-target
        -fitc --fit-ctx
        --check-tensors
        --override-kv
        --op-offload
        --lora
        --lora-scaled
        --control-vector
        --control-vector-scaled
        --control-vector-layer-range
        --log-disable
        --log-file
        --log-jsonl
        --log-colors
        -v --verbose --log-verbose
        -lv --verbosity --log-verbosity
        --log-prefix
        --log-timestamps
        --spec-draft-type-k -ctkd --cache-type-k-draft
        --spec-draft-type-v -ctvd --cache-type-v-draft
        --samplers
        -s --seed
        --sampler-seq --sampling-seq
        --ignore-eos
        --temp --temperature
        --top-k
        --top-p
        --min-p
        --top-nsigma --top-n-sigma
        --xtc-probability
        --xtc-threshold
        --typical --typical-p
        --repeat-last-n
        --repeat-penalty
        --presence-penalty
        --frequency-penalty
        --dry-multiplier
        --dry-base
        --dry-allowed-length
        --dry-penalty-last-n
        --dry-sequence-breaker
        --adaptive-target
        --adaptive-decay
        --dynatemp-range
        --dynatemp-exp
        --mirostat
        --mirostat-lr
        --mirostat-ent
        -l --logit-bias
        --grammar
        --grammar-file
        -j --json-schema
        -jf --json-schema-file
        -bs --backend-sampling
        -m --model
        -mu --model-url
        -dr --docker-repo
        -hf -hfr --hf-repo
        -hff --hf-file
        -hft --hf-token
        --ids
        --stdin
        --no-bos
        --no-parse-special
        --show-count
        --offline
    "

    case "$prev" in
        -h | --help | --usage )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print usage and exit"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --version )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
show version and build info"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -cl | --cache-list )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
show list of models in cache"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --completion-bash )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print source-able bash completion script for llama.cpp"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -t | --threads )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of CPU threads to use during generation (default: -1)
(env: LLAMA_ARG_THREADS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -tb | --threads-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of threads to use during batch and prompt processing (default: same as --threads)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -C | --cpu-mask )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
CPU affinity mask: arbitrarily long hex. Complements cpu-range (default: \"\")"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Cr | --cpu-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
range of CPUs for affinity. Complements --cpu-mask"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --cpu-strict )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use strict CPU placement (default: 0)
"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --prio )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set process/thread priority : low(-1), normal(0), medium(1), high(2), realtime(3) (default: 0)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --poll )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use polling level to wait for work (0 - no polling, default: 50)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Cb | --cpu-mask-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
CPU affinity mask: arbitrarily long hex. Complements cpu-range-batch (default: same as --cpu-mask)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Crb | --cpu-range-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ranges of CPUs for affinity. Complements --cpu-mask-batch"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --cpu-strict-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use strict CPU placement (default: same as --cpu-strict)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --prio-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set process/thread priority : 0-normal, 1-medium, 2-high, 3-realtime (default: 0)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --poll-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use polling to wait for work (default: same as --poll)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        -c | --ctx-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
size of the prompt context (default: 0, 0 = loaded from model)
(env: LLAMA_ARG_CTX_SIZE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -n | --predict | --n-predict )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of tokens to predict (default: -1, -1 = infinity)
(env: LLAMA_ARG_N_PREDICT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -b | --batch-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
logical maximum batch size (default: 2048)
(env: LLAMA_ARG_BATCH)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ub | --ubatch-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
physical maximum batch size (default: 512)
(env: LLAMA_ARG_UBATCH)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --keep )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of tokens to keep from the initial prompt (default: 0, -1 = all)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --swa-full )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fa | --flash-attn )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
set Flash Attention use ('on', 'off', or 'auto', default: 'auto')
(env: LLAMA_ARG_FLASH_ATTN)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        -p | --prompt )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
prompt to start generation with; for system message, use -sys"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --perf )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable internal libllama performance timings (default: false)
(env: LLAMA_ARG_PERF)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -f | --file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
a file containing the prompt (default: none)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -bf | --binary-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
binary file containing the prompt (default: none)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -e | --escape )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to process escapes sequences (\\n, \\r, \\t, \\', \\\", \\\\) (default: true)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-scaling )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
RoPE frequency scaling method, defaults to linear unless specified by the model
(env: LLAMA_ARG_ROPE_SCALING_TYPE)"
            fi
            COMPREPLY=( $(compgen -W 'none linear yarn' -- "$cur") )
            return 0
        ;;
        --rope-scale )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE context scaling factor, expands context by a factor of N
(env: LLAMA_ARG_ROPE_SCALE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-freq-base )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE base frequency, used by NTK-aware scaling (default: loaded from model)
(env: LLAMA_ARG_ROPE_FREQ_BASE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-freq-scale )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE frequency scaling factor, expands context by a factor of 1/N
(env: LLAMA_ARG_ROPE_FREQ_SCALE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-orig-ctx )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: original context size of model (default: 0 = model training context size)
(env: LLAMA_ARG_YARN_ORIG_CTX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-ext-factor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: extrapolation mix factor (default: -1.00, 0.0 = full interpolation)
(env: LLAMA_ARG_YARN_EXT_FACTOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-attn-factor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: scale sqrt(t) or attention magnitude (default: -1.00)
(env: LLAMA_ARG_YARN_ATTN_FACTOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-beta-slow )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: high correction dim or alpha (default: -1.00)
(env: LLAMA_ARG_YARN_BETA_SLOW)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-beta-fast )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: low correction dim or beta (default: -1.00)
(env: LLAMA_ARG_YARN_BETA_FAST)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -kvo | --kv-offload )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable KV cache offloading (default: enabled)
(env: LLAMA_ARG_KV_OFFLOAD)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repack )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable weight repacking (default: enabled)
(env: LLAMA_ARG_REPACK)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --no-host )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
bypass host buffer allowing extra buffers to be used
(env: LLAMA_ARG_NO_HOST)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ctk | --cache-type-k )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ctv | --cache-type-v )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -dt | --defrag-thold )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
KV cache defragmentation threshold (DEPRECATED)
(env: LLAMA_ARG_DEFRAG_THOLD)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -np | --parallel )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of parallel sequences to decode (default: 1)
(env: LLAMA_ARG_N_PARALLEL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rpc )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
comma-separated list of RPC servers (host:port)
(env: LLAMA_ARG_RPC)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -lm | --load-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
model loading mode (default: auto)
- 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)"
            fi
            COMPREPLY=( $(compgen -W 'auto none mmap mlock mmap+mlock dio' -- "$cur") )
            return 0
        ;;
        -lzm | --lazy-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
on-demand reading of certain tensors, for example per-layer embeddings (default: auto)
- on: read the rows of such tensors from disk on demand instead of keeping them resident (requires mmap)
- auto: on, but only for tensors larger than 4 GiB
- off: always keep them resident
(env: LLAMA_ARG_LAZY_MODE)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        --numa )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
attempt optimizations that help on some NUMA systems
- 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)"
            fi
            COMPREPLY=( $(compgen -W 'distribute isolate numactl' -- "$cur") )
            return 0
        ;;
        -dev | --device )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --list-devices )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print list of available devices and exit"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ot | --override-tensor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
override tensor buffer type
(env: LLAMA_ARG_OVERRIDE_TENSOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -cmoe | --cpu-moe )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep all Mixture of Experts (MoE) weights in the CPU
(env: LLAMA_ARG_CPU_MOE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ncmoe | --n-cpu-moe )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep the Mixture of Experts (MoE) weights of the first N layers in the CPU
(env: LLAMA_ARG_N_CPU_MOE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --moe-cache-mib )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
GPU cache size in MiB for the MoE experts kept in the CPU. with multiple GPUs, it is split among them like the layers (--tensor-split) (default: 0, disabled)
(env: LLAMA_ARG_MOE_CACHE_MIB)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ncffn | --n-cpu-ffn )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep the dense FFN weights of the first N layers in the CPU
(dense models; for MoE expert weights use --n-cpu-moe)
(env: LLAMA_ARG_N_CPU_FFN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ngl | --gpu-layers | --n-gpu-layers )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
max. number of layers to store in VRAM, either an exact number, 'auto', or 'all' (default: auto)
(env: LLAMA_ARG_N_GPU_LAYERS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -sm | --split-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
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)"
            fi
            COMPREPLY=( $(compgen -W 'none layer row split' -- "$cur") )
            return 0
        ;;
        -ts | --tensor-split )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
fraction of the model to offload to each GPU, comma-separated list of proportions, e.g. 3,1
(env: LLAMA_ARG_TENSOR_SPLIT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -mg | --main-gpu )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fit | --fit )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
whether to adjust unset arguments to fit in device memory ('on' or 'off', default: 'on')
(env: LLAMA_ARG_FIT)"
            fi
            COMPREPLY=( $(compgen -W 'on off' -- "$cur") )
            return 0
        ;;
        -fitt | --fit-target )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fitc | --fit-ctx )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
minimum ctx size that can be set by --fit option, default: 4096
(env: LLAMA_ARG_FIT_CTX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --check-tensors )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
check model tensor data for invalid values (default: false)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --override-kv )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --op-offload )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to offload host tensor operations to device (default: true)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --lora )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to LoRA adapter (use comma-separated values to load multiple adapters)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --lora-scaled )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to LoRA adapter with user defined scaling (format: FNAME:SCALE,...)
note: use comma-separated values"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add a control vector
note: use comma-separated values to add multiple control vectors"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector-scaled )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add a control vector with user defined scaling SCALE
note: use comma-separated values (format: FNAME:SCALE,...)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector-layer-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
layer range to apply the control vector(s) to, start and end inclusive"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-disable )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log disable"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log to file
(env: LLAMA_ARG_LOG_FILE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-jsonl )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log as JSONL (one JSON object per line) to stdout, this also disables colored logging (default: disabled)
(env: LLAMA_ARG_LOG_JSONL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-colors )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
Set colored logging ('on', 'off', or 'auto', default: 'auto')
'auto' enables colors when output is to a terminal
(env: LLAMA_ARG_LOG_COLORS)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        -v | --verbose | --log-verbose )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Set verbosity level to infinity (i.e. log all messages, useful for debugging)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -lv | --verbosity | --log-verbosity )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Set the verbosity threshold. Messages with a higher verbosity will be ignored. Values:
 - 0: generic output
 - 1: error
 - 2: warning
 - 3: info
 - 4: trace (more info)
 - 5: debug
(default: 3)

(env: LLAMA_ARG_LOG_VERBOSITY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-prefix )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Enable prefix in log messages
(env: LLAMA_ARG_LOG_PREFIX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-timestamps )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Enable timestamps in log messages
(env: LLAMA_ARG_LOG_TIMESTAMPS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-type-k | -ctkd | --cache-type-k-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-type-v | -ctvd | --cache-type-v-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
KV cache data type for V 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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --samplers )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
samplers that will be used for generation in the order, separated by ';'
(default: penalties;dry;top_n_sigma;top_k;typ_p;top_p;min_p;xtc;temperature)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -s | --seed )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RNG seed (default: -1, use random seed for -1)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --sampler-seq | --sampling-seq )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
simplified sequence for samplers that will be used (default: edskypmxt)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --ignore-eos )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ignore end of stream token and continue generating (implies --logit-bias EOS-inf)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --temp | --temperature )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
temperature (default: 0.80)
(env: LLAMA_ARG_TEMPERATURE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-k )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-k sampling (default: 40, 0 = disabled)
(env: LLAMA_ARG_TOP_K)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-p sampling (default: 0.95, 1.0 = disabled)
(env: LLAMA_ARG_TOP_P)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --min-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
min-p sampling (default: 0.05, 0.0 = disabled)
(env: LLAMA_ARG_MIN_P)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-nsigma | --top-n-sigma )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-n-sigma sampling (default: -1.00, -1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --xtc-probability )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
xtc probability (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --xtc-threshold )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
xtc threshold (default: 0.10, 1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --typical | --typical-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
locally typical sampling, parameter p (default: 1.00, 1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repeat-last-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
last n tokens to consider for penalize (default: 64, 0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repeat-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
penalize repeat sequence of tokens (default: 1.00, 1.0 = disabled)
(env: LLAMA_ARG_REPEAT_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --presence-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
repeat alpha presence penalty (default: 0.00, 0.0 = disabled)
(env: LLAMA_ARG_PRESENCE_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --frequency-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
repeat alpha frequency penalty (default: 0.00, 0.0 = disabled)
(env: LLAMA_ARG_FREQUENCY_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-multiplier )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY sampling multiplier (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-base )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY sampling base value (default: 1.75)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-allowed-length )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set allowed length for DRY sampling (default: 2)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-penalty-last-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY penalty for the last n tokens (default: 64, 0 = disable)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-sequence-breaker )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add sequence breaker for DRY sampling, clearing out default breakers ('\\n', ':', '\"', '*') in the process; use \"none\" to not use any sequence breakers
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --adaptive-target )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
adaptive-p: select tokens near this probability (valid range 0.0 to 1.0; negative = disabled) (default: -1.00)
[(more info)](https://github.com/ggml-org/llama.cpp/pull/17927)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --adaptive-decay )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
adaptive-p: 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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dynatemp-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
dynamic temperature range (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dynatemp-exp )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
dynamic temperature exponent (default: 1.00)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use Mirostat sampling.
Top K, Nucleus and Locally Typical samplers are ignored if used.
(default: 0, 0 = disabled, 1 = Mirostat, 2 = Mirostat 2.0)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat-lr )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Mirostat learning rate, parameter eta (default: 0.10)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat-ent )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Mirostat target entropy, parameter tau (default: 5.00)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -l | --logit-bias )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
modifies the likelihood of token appearing in the completion,
i.e. \`--logit-bias 15043+1\` to increase likelihood of token ' Hello',
or \`--logit-bias 15043-1\` to decrease likelihood of token ' Hello'"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --grammar )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
BNF-like grammar to constrain generations (see samples in grammars/ dir)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --grammar-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
file to read grammar from"
            fi
            COMPREPLY=( $(compgen -f -X '!*.gbnf' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -j | --json-schema )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
JSON schema to constrain generations (https://json-schema.org/), e.g. \`{\"type\": \"object\"}\` for any JSON object"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -jf | --json-schema-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
File containing a JSON schema to constrain generations (https://json-schema.org/), e.g. \`{\"type\": \"object\"}\` for any JSON object"
            fi
            COMPREPLY=( $(compgen -f -X '!*.json' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -bs | --backend-sampling )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
enable backend sampling (experimental) (default: disabled)
(env: LLAMA_ARG_BACKEND_SAMPLING)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -m | --model )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
model path to load
(env: LLAMA_ARG_MODEL)"
            fi
            COMPREPLY=( $(compgen -f -X '!*.gguf' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -mu | --model-url )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
model download url (default: unused)
(env: LLAMA_ARG_MODEL_URL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -dr | --docker-repo )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Docker Hub model repository. repo is optional, default to ai/. quant is optional, default to :latest.
example: gemma3
(default: unused)
(env: LLAMA_ARG_DOCKER_REPO)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hf | -hfr | --hf-repo )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face model repository; quant is optional, case-insensitive, default to Q4_K_M, or falls back to the first file in the repo if Q4_K_M doesn't exist.
mmproj is also downloaded automatically if available. to disable, add --no-mmproj
example: ggml-org/GLM-4.7-Flash-GGUF:Q4_K_M
(default: unused)
(env: LLAMA_ARG_HF_REPO)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hff | --hf-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face model file. If specified, it will override the quant in --hf-repo (default: unused)
(env: LLAMA_ARG_HF_FILE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hft | --hf-token )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face access token (default: value from HF_TOKEN environment variable)
(env: HF_TOKEN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --ids )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
only print the token IDs, in a Python-parseable list form like [1, 2, 3] (default: false)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --stdin )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
read the prompt from stdin (takes precedence over -f/--file and -p/--prompt) (default: false)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --no-bos )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
do not add a BOS token to the prompt, even if the model normally uses one (default: false)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --no-parse-special )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
do not parse special tokens (chat, tool, etc) (default: false)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --show-count )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print the total number of tokens (default: false)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --offline )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Offline mode: forces use of cache, prevents network access
(env: LLAMA_ARG_OFFLINE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
    esac

case "$curr" in
    -* )
        COMPREPLY=( $(compgen -W "${opts}" -- "$curr") )
        return 0
    ;;
esac
} && complete -F _comp_cmd_llama_tokenize llama-tokenize

_comp_cmd_llama_tts()
{
    local curr prev opts
    COMPREPLY=()
    curr="${COMP_WORDS[COMP_CWORD]}"
    prev="${COMP_WORDS[COMP_CWORD-1]}"

    opts="
        -h --help --usage
        --version
        -cl --cache-list
        --completion-bash
        -t --threads
        -tb --threads-batch
        -C --cpu-mask
        -Cr --cpu-range
        --cpu-strict
        --prio
        --poll
        -Cb --cpu-mask-batch
        -Crb --cpu-range-batch
        --cpu-strict-batch
        --prio-batch
        --poll-batch
        -c --ctx-size
        -n --predict --n-predict
        -b --batch-size
        -ub --ubatch-size
        --keep
        --swa-full
        -fa --flash-attn
        -p --prompt
        --perf
        -f --file
        -bf --binary-file
        -e --escape
        --rope-scaling
        --rope-scale
        --rope-freq-base
        --rope-freq-scale
        --yarn-orig-ctx
        --yarn-ext-factor
        --yarn-attn-factor
        --yarn-beta-slow
        --yarn-beta-fast
        -kvo --kv-offload
        --repack
        --no-host
        -ctk --cache-type-k
        -ctv --cache-type-v
        -dt --defrag-thold
        -np --parallel
        --rpc
        -lm --load-mode
        -lzm --lazy-mode
        --numa
        -dev --device
        --list-devices
        -ot --override-tensor
        -cmoe --cpu-moe
        -ncmoe --n-cpu-moe
        --moe-cache-mib
        -ncffn --n-cpu-ffn
        -ngl --gpu-layers --n-gpu-layers
        -sm --split-mode
        -ts --tensor-split
        -mg --main-gpu
        -fit --fit
        -fitt --fit-target
        -fitc --fit-ctx
        --check-tensors
        --override-kv
        --op-offload
        --lora
        --lora-scaled
        --control-vector
        --control-vector-scaled
        --control-vector-layer-range
        -m --model
        -mu --model-url
        -dr --docker-repo
        -hf -hfr --hf-repo
        -hff --hf-file
        -hft --hf-token
        --log-disable
        --log-file
        --log-jsonl
        --log-colors
        -v --verbose --log-verbose
        --offline
        -lv --verbosity --log-verbosity
        --log-prefix
        --log-timestamps
        --spec-draft-type-k -ctkd --cache-type-k-draft
        --spec-draft-type-v -ctvd --cache-type-v-draft
        --samplers
        -s --seed
        --sampler-seq --sampling-seq
        --ignore-eos
        --temp --temperature
        --top-k
        --top-p
        --min-p
        --top-nsigma --top-n-sigma
        --xtc-probability
        --xtc-threshold
        --typical --typical-p
        --repeat-last-n
        --repeat-penalty
        --presence-penalty
        --frequency-penalty
        --dry-multiplier
        --dry-base
        --dry-allowed-length
        --dry-penalty-last-n
        --dry-sequence-breaker
        --adaptive-target
        --adaptive-decay
        --dynatemp-range
        --dynatemp-exp
        --mirostat
        --mirostat-lr
        --mirostat-ent
        -l --logit-bias
        --grammar
        --grammar-file
        -j --json-schema
        -jf --json-schema-file
        -bs --backend-sampling
        -mm --mmproj
        -mmu --mmproj-url
        --mmproj-offload
        -mmdev --mmproj-device
        --image-min-tokens
        --image-max-tokens
        --video-fps
        --video-timestamp-interval
        --video-ffmpeg-dir
        -o --output --output-file
        --tts-lang
        --tts-voice
        --tts-speaker-file
    "

    case "$prev" in
        -h | --help | --usage )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print usage and exit"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --version )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
show version and build info"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -cl | --cache-list )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
show list of models in cache"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --completion-bash )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print source-able bash completion script for llama.cpp"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -t | --threads )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of CPU threads to use during generation (default: -1)
(env: LLAMA_ARG_THREADS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -tb | --threads-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of threads to use during batch and prompt processing (default: same as --threads)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -C | --cpu-mask )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
CPU affinity mask: arbitrarily long hex. Complements cpu-range (default: \"\")"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Cr | --cpu-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
range of CPUs for affinity. Complements --cpu-mask"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --cpu-strict )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use strict CPU placement (default: 0)
"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --prio )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set process/thread priority : low(-1), normal(0), medium(1), high(2), realtime(3) (default: 0)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --poll )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use polling level to wait for work (0 - no polling, default: 50)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Cb | --cpu-mask-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
CPU affinity mask: arbitrarily long hex. Complements cpu-range-batch (default: same as --cpu-mask)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -Crb | --cpu-range-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ranges of CPUs for affinity. Complements --cpu-mask-batch"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --cpu-strict-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use strict CPU placement (default: same as --cpu-strict)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        --prio-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set process/thread priority : 0-normal, 1-medium, 2-high, 3-realtime (default: 0)
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --poll-batch )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
use polling to wait for work (default: same as --poll)"
            fi
            COMPREPLY=( 0 1 )
            return 0
        ;;
        -c | --ctx-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
size of the prompt context (default: 0, 0 = loaded from model)
(env: LLAMA_ARG_CTX_SIZE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -n | --predict | --n-predict )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of tokens to predict (default: -1, -1 = infinity)
(env: LLAMA_ARG_N_PREDICT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -b | --batch-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
logical maximum batch size (default: 2048)
(env: LLAMA_ARG_BATCH)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ub | --ubatch-size )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
physical maximum batch size (default: 512)
(env: LLAMA_ARG_UBATCH)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --keep )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of tokens to keep from the initial prompt (default: 0, -1 = all)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --swa-full )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fa | --flash-attn )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
set Flash Attention use ('on', 'off', or 'auto', default: 'auto')
(env: LLAMA_ARG_FLASH_ATTN)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        -p | --prompt )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
prompt to start generation with; for system message, use -sys"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --perf )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable internal libllama performance timings (default: false)
(env: LLAMA_ARG_PERF)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -f | --file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
a file containing the prompt (default: none)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -bf | --binary-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
binary file containing the prompt (default: none)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -e | --escape )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to process escapes sequences (\\n, \\r, \\t, \\', \\\", \\\\) (default: true)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-scaling )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
RoPE frequency scaling method, defaults to linear unless specified by the model
(env: LLAMA_ARG_ROPE_SCALING_TYPE)"
            fi
            COMPREPLY=( $(compgen -W 'none linear yarn' -- "$cur") )
            return 0
        ;;
        --rope-scale )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE context scaling factor, expands context by a factor of N
(env: LLAMA_ARG_ROPE_SCALE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-freq-base )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE base frequency, used by NTK-aware scaling (default: loaded from model)
(env: LLAMA_ARG_ROPE_FREQ_BASE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rope-freq-scale )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RoPE frequency scaling factor, expands context by a factor of 1/N
(env: LLAMA_ARG_ROPE_FREQ_SCALE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-orig-ctx )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: original context size of model (default: 0 = model training context size)
(env: LLAMA_ARG_YARN_ORIG_CTX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-ext-factor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: extrapolation mix factor (default: -1.00, 0.0 = full interpolation)
(env: LLAMA_ARG_YARN_EXT_FACTOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-attn-factor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: scale sqrt(t) or attention magnitude (default: -1.00)
(env: LLAMA_ARG_YARN_ATTN_FACTOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-beta-slow )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: high correction dim or alpha (default: -1.00)
(env: LLAMA_ARG_YARN_BETA_SLOW)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --yarn-beta-fast )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
YaRN: low correction dim or beta (default: -1.00)
(env: LLAMA_ARG_YARN_BETA_FAST)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -kvo | --kv-offload )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable KV cache offloading (default: enabled)
(env: LLAMA_ARG_KV_OFFLOAD)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repack )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable weight repacking (default: enabled)
(env: LLAMA_ARG_REPACK)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --no-host )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
bypass host buffer allowing extra buffers to be used
(env: LLAMA_ARG_NO_HOST)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ctk | --cache-type-k )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ctv | --cache-type-v )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -dt | --defrag-thold )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
KV cache defragmentation threshold (DEPRECATED)
(env: LLAMA_ARG_DEFRAG_THOLD)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -np | --parallel )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
number of parallel sequences to decode (default: 1)
(env: LLAMA_ARG_N_PARALLEL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --rpc )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
comma-separated list of RPC servers (host:port)
(env: LLAMA_ARG_RPC)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -lm | --load-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
model loading mode (default: auto)
- 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)"
            fi
            COMPREPLY=( $(compgen -W 'auto none mmap mlock mmap+mlock dio' -- "$cur") )
            return 0
        ;;
        -lzm | --lazy-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
on-demand reading of certain tensors, for example per-layer embeddings (default: auto)
- on: read the rows of such tensors from disk on demand instead of keeping them resident (requires mmap)
- auto: on, but only for tensors larger than 4 GiB
- off: always keep them resident
(env: LLAMA_ARG_LAZY_MODE)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        --numa )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
attempt optimizations that help on some NUMA systems
- 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)"
            fi
            COMPREPLY=( $(compgen -W 'distribute isolate numactl' -- "$cur") )
            return 0
        ;;
        -dev | --device )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --list-devices )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
print list of available devices and exit"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ot | --override-tensor )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
override tensor buffer type
(env: LLAMA_ARG_OVERRIDE_TENSOR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -cmoe | --cpu-moe )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep all Mixture of Experts (MoE) weights in the CPU
(env: LLAMA_ARG_CPU_MOE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ncmoe | --n-cpu-moe )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep the Mixture of Experts (MoE) weights of the first N layers in the CPU
(env: LLAMA_ARG_N_CPU_MOE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --moe-cache-mib )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
GPU cache size in MiB for the MoE experts kept in the CPU. with multiple GPUs, it is split among them like the layers (--tensor-split) (default: 0, disabled)
(env: LLAMA_ARG_MOE_CACHE_MIB)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ncffn | --n-cpu-ffn )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
keep the dense FFN weights of the first N layers in the CPU
(dense models; for MoE expert weights use --n-cpu-moe)
(env: LLAMA_ARG_N_CPU_FFN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -ngl | --gpu-layers | --n-gpu-layers )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
max. number of layers to store in VRAM, either an exact number, 'auto', or 'all' (default: auto)
(env: LLAMA_ARG_N_GPU_LAYERS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -sm | --split-mode )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
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)"
            fi
            COMPREPLY=( $(compgen -W 'none layer row split' -- "$cur") )
            return 0
        ;;
        -ts | --tensor-split )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
fraction of the model to offload to each GPU, comma-separated list of proportions, e.g. 3,1
(env: LLAMA_ARG_TENSOR_SPLIT)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -mg | --main-gpu )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fit | --fit )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
whether to adjust unset arguments to fit in device memory ('on' or 'off', default: 'on')
(env: LLAMA_ARG_FIT)"
            fi
            COMPREPLY=( $(compgen -W 'on off' -- "$cur") )
            return 0
        ;;
        -fitt | --fit-target )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -fitc | --fit-ctx )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
minimum ctx size that can be set by --fit option, default: 4096
(env: LLAMA_ARG_FIT_CTX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --check-tensors )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
check model tensor data for invalid values (default: false)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --override-kv )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --op-offload )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to offload host tensor operations to device (default: true)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --lora )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to LoRA adapter (use comma-separated values to load multiple adapters)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --lora-scaled )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to LoRA adapter with user defined scaling (format: FNAME:SCALE,...)
note: use comma-separated values"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add a control vector
note: use comma-separated values to add multiple control vectors"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector-scaled )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add a control vector with user defined scaling SCALE
note: use comma-separated values (format: FNAME:SCALE,...)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --control-vector-layer-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
layer range to apply the control vector(s) to, start and end inclusive"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -m | --model )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
model path to load
(env: LLAMA_ARG_MODEL)"
            fi
            COMPREPLY=( $(compgen -f -X '!*.gguf' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -mu | --model-url )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
model download url (default: unused)
(env: LLAMA_ARG_MODEL_URL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -dr | --docker-repo )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Docker Hub model repository. repo is optional, default to ai/. quant is optional, default to :latest.
example: gemma3
(default: unused)
(env: LLAMA_ARG_DOCKER_REPO)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hf | -hfr | --hf-repo )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face model repository; quant is optional, case-insensitive, default to Q4_K_M, or falls back to the first file in the repo if Q4_K_M doesn't exist.
mmproj is also downloaded automatically if available. to disable, add --no-mmproj
example: ggml-org/GLM-4.7-Flash-GGUF:Q4_K_M
(default: unused)
(env: LLAMA_ARG_HF_REPO)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hff | --hf-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face model file. If specified, it will override the quant in --hf-repo (default: unused)
(env: LLAMA_ARG_HF_FILE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -hft | --hf-token )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Hugging Face access token (default: value from HF_TOKEN environment variable)
(env: HF_TOKEN)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-disable )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log disable"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log to file
(env: LLAMA_ARG_LOG_FILE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-jsonl )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Log as JSONL (one JSON object per line) to stdout, this also disables colored logging (default: disabled)
(env: LLAMA_ARG_LOG_JSONL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-colors )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
Set colored logging ('on', 'off', or 'auto', default: 'auto')
'auto' enables colors when output is to a terminal
(env: LLAMA_ARG_LOG_COLORS)"
            fi
            COMPREPLY=( $(compgen -W 'on off auto' -- "$cur") )
            return 0
        ;;
        -v | --verbose | --log-verbose )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Set verbosity level to infinity (i.e. log all messages, useful for debugging)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --offline )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Offline mode: forces use of cache, prevents network access
(env: LLAMA_ARG_OFFLINE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -lv | --verbosity | --log-verbosity )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Set the verbosity threshold. Messages with a higher verbosity will be ignored. Values:
 - 0: generic output
 - 1: error
 - 2: warning
 - 3: info
 - 4: trace (more info)
 - 5: debug
(default: 3)

(env: LLAMA_ARG_LOG_VERBOSITY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-prefix )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Enable prefix in log messages
(env: LLAMA_ARG_LOG_PREFIX)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --log-timestamps )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Enable timestamps in log messages
(env: LLAMA_ARG_LOG_TIMESTAMPS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-type-k | -ctkd | --cache-type-k-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --spec-draft-type-v | -ctvd | --cache-type-v-draft )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
KV cache data type for V 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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --samplers )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
samplers that will be used for generation in the order, separated by ';'
(default: penalties;dry;top_n_sigma;top_k;typ_p;top_p;min_p;xtc;temperature)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -s | --seed )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
RNG seed (default: -1, use random seed for -1)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --sampler-seq | --sampling-seq )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
simplified sequence for samplers that will be used (default: edskypmxt)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --ignore-eos )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
ignore end of stream token and continue generating (implies --logit-bias EOS-inf)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --temp | --temperature )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
temperature (default: 0.80)
(env: LLAMA_ARG_TEMPERATURE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-k )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-k sampling (default: 40, 0 = disabled)
(env: LLAMA_ARG_TOP_K)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-p sampling (default: 0.95, 1.0 = disabled)
(env: LLAMA_ARG_TOP_P)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --min-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
min-p sampling (default: 0.05, 0.0 = disabled)
(env: LLAMA_ARG_MIN_P)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --top-nsigma | --top-n-sigma )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
top-n-sigma sampling (default: -1.00, -1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --xtc-probability )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
xtc probability (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --xtc-threshold )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
xtc threshold (default: 0.10, 1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --typical | --typical-p )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
locally typical sampling, parameter p (default: 1.00, 1.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repeat-last-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
last n tokens to consider for penalize (default: -1, 0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --repeat-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
penalize repeat sequence of tokens (default: 1.05, 1.0 = disabled)
(env: LLAMA_ARG_REPEAT_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --presence-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
repeat alpha presence penalty (default: 0.00, 0.0 = disabled)
(env: LLAMA_ARG_PRESENCE_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --frequency-penalty )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
repeat alpha frequency penalty (default: 0.00, 0.0 = disabled)
(env: LLAMA_ARG_FREQUENCY_PENALTY)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-multiplier )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY sampling multiplier (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-base )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY sampling base value (default: 1.75)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-allowed-length )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set allowed length for DRY sampling (default: 2)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-penalty-last-n )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
set DRY penalty for the last n tokens (default: 64, 0 = disable)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dry-sequence-breaker )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
add sequence breaker for DRY sampling, clearing out default breakers ('\\n', ':', '\"', '*') in the process; use \"none\" to not use any sequence breakers
"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --adaptive-target )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
adaptive-p: select tokens near this probability (valid range 0.0 to 1.0; negative = disabled) (default: -1.00)
[(more info)](https://github.com/ggml-org/llama.cpp/pull/17927)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --adaptive-decay )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
adaptive-p: 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)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dynatemp-range )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
dynamic temperature range (default: 0.00, 0.0 = disabled)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --dynatemp-exp )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
dynamic temperature exponent (default: 1.00)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
use Mirostat sampling.
Top K, Nucleus and Locally Typical samplers are ignored if used.
(default: 0, 0 = disabled, 1 = Mirostat, 2 = Mirostat 2.0)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat-lr )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Mirostat learning rate, parameter eta (default: 0.10)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mirostat-ent )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
Mirostat target entropy, parameter tau (default: 5.00)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -l | --logit-bias )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
modifies the likelihood of token appearing in the completion,
i.e. \`--logit-bias 15043+1\` to increase likelihood of token ' Hello',
or \`--logit-bias 15043-1\` to decrease likelihood of token ' Hello'"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --grammar )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
BNF-like grammar to constrain generations (see samples in grammars/ dir)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --grammar-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
file to read grammar from"
            fi
            COMPREPLY=( $(compgen -f -X '!*.gbnf' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -j | --json-schema )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
JSON schema to constrain generations (https://json-schema.org/), e.g. \`{\"type\": \"object\"}\` for any JSON object"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -jf | --json-schema-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
File containing a JSON schema to constrain generations (https://json-schema.org/), e.g. \`{\"type\": \"object\"}\` for any JSON object"
            fi
            COMPREPLY=( $(compgen -f -X '!*.json' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -bs | --backend-sampling )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
enable backend sampling (experimental) (default: disabled)
(env: LLAMA_ARG_BACKEND_SAMPLING)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -mm | --mmproj )
            if   (( 63 == COMP_TYPE ))
            then
                echo "
*** Help: $prev ***
path to a multimodal projector file. see tools/mtmd/README.md
note: if -hf is used, this argument can be omitted
(env: LLAMA_ARG_MMPROJ)"
            fi
            COMPREPLY=( $(compgen -f -X '!*.mmproj' -- "$cur") $(compgen -d -- "$cur") )
            return 0
        ;;
        -mmu | --mmproj-url )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
URL to a multimodal projector file. see tools/mtmd/README.md
(env: LLAMA_ARG_MMPROJ_URL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --mmproj-offload )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
whether to enable GPU offloading for multimodal projector (default: enabled)
(env: LLAMA_ARG_MMPROJ_OFFLOAD)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -mmdev | --mmproj-device )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
device to use for multimodal projector (none = don't offload, default: follows --device)
use --list-devices to see a list of available devices
(env: MTMD_BACKEND_DEVICE)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --image-min-tokens )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
minimum number of tokens each image can take, only used by vision models with dynamic resolution (default: read from model)
(env: LLAMA_ARG_IMAGE_MIN_TOKENS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --image-max-tokens )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
maximum number of tokens each image can take, only used by vision models with dynamic resolution (default: read from model)
(env: LLAMA_ARG_IMAGE_MAX_TOKENS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --video-fps )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
target video frame rate (default: 4.0)
(env: LLAMA_ARG_VIDEO_FPS)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --video-timestamp-interval )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
interval in milliseconds between text timestamps (default: 5000)
(env: LLAMA_ARG_VIDEO_TIMESTAMP_INTERVAL)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --video-ffmpeg-dir )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
path to the directory containing ffmpeg and ffprobe (default: search in PATH)
(env: LLAMA_ARG_VIDEO_FFMPEG_DIR)"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        -o | --output | --output-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
output file (default: 'output.wav')"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --tts-lang )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
language (ISO 639-1) for audio generation
see tts/README.md for per-model usage notes"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --tts-voice )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
voice for audio generation (model-dependent)
see tts/README.md for per-model usage notes"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
        --tts-speaker-file )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
speaker file path for audio generation"
                COMPREPLY=( "" )
            fi
            return 0
        ;;
    esac

case "$curr" in
    -* )
        COMPREPLY=( $(compgen -W "${opts}" -- "$curr") )
        return 0
    ;;
esac
} && complete -F _comp_cmd_llama_tts llama-tts
