_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
        --moe-cache-cpu-share
        -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
        ;;
        --moe-cache-cpu-share )
            if   (( 63 == COMP_TYPE ))
            then
                echo -n "
*** Help: $prev ***
share of the MoE cache misses that the CPU computes from the host experts instead of uploading them to the GPU once the cache is full, from 0 to 1 (default: 0.00)
(env: LLAMA_ARG_MOE_CACHE_CPU_SHARE)"
                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
