xllamacpp Parameters Reference

July 5, 2026 · View on GitHub

This document is auto-generated from the Cython wrapper (.pyx) and the C++ common.h header. It lists all Python-accessible properties of each configuration class, along with their types, default values, and descriptions.

Regenerate: python scripts/generate_params_doc.py

Table of Contents


CommonAdapterLoraInfo

LoRA adapter info. Create via xlc.CommonAdapterLoraInfo(path, scale).

PropertyTypeDefaultR/WDescription
pathstr``R/WLoRA adapter file path.
scalefloat``R/WLoRA adapter scale factor.

CommonParams

The central configuration object. Controls model loading, inference, sampling, server behavior, and more. Create via xlc.CommonParams().

Attention / KV Cache

PropertyTypeDefaultR/WDescription
attention_typellama_attention_typeLLAMA_ATTENTION_TYPE_UNSPECIFIEDR/Wattention type for embeddings.
cache_type_kggml_typeGGML_TYPE_F16R/WKV cache data type for the K
cache_type_vggml_typeGGML_TYPE_F16R/WKV cache data type for the V
ctx_shiftboolfalseR/Wcontext shift on inifinite text generation
flash_attn_typellama_flash_attn_typeLLAMA_FLASH_ATTN_TYPE_AUTOR/Wwhether to use Flash Attention.
kv_unifiedboolfalseR/Wenable unified KV cache
pooling_typellama_pooling_typeLLAMA_POOLING_TYPE_UNSPECIFIEDR/Wpooling type for embeddings.
swa_fullboolfalseR/Wuse full-size SWA cache (https://github.com/ggml-org/llama.cpp/pull/13194#issuecomment-2868343055)

Batched Bench

PropertyTypeDefaultR/WDescription
is_pp_sharedboolfalseR/Wbatched-bench params
is_tg_separateboolfalseR/Wbatched-bench params
n_pllist[int]``R/W
n_pplist[int]``R/W
n_tglist[int]``R/W

Behavior Flags

PropertyTypeDefaultR/WDescription
check_tensorsboolfalseR/Wvalidate tensor data
cont_batchingbooltrueR/Winsert new sequences for decoding on-the-fly
display_promptbooltrueR/Wprint prompt before generation
escapebooltrueR/Wescape "\n", "\r", "\t", "'", """, and "\"
interactiveboolfalseR/Winteractive mode
multiline_inputboolfalseR/Wreverse the usage of ""
no_perfboolfalseR/Wdisable performance metrics
offlineboolfalseR/W
prompt_cache_allboolfalseR/Wsave user input and generations to prompt cache
prompt_cache_roboolfalseR/Wopen the prompt cache read-only and do not update it
show_timingsbooltrueR/Wshow timing information on CLI
simple_ioboolfalseR/Wimproves compatibility with subprocesses and limited consoles
single_turnboolfalseR/Wsingle turn chat conversation
specialboolfalseR/Wenable special token output
usageboolfalseR/Wprint usage
use_colorboolfalseR/Wuse color to distinguish generations and inputs
use_direct_ioboolfalseR/Wread from disk without buffering
use_mlockboolfalseR/Wuse mlock to keep model in memory
use_mmapbooltrueR/Wenable mmap to use filesystem cache
verbose_promptboolfalseR/Wprint prompt tokens before generation
warmupbooltrueR/Wwarmup run

CPU

PropertyTypeDefaultR/WDescription
cpuparamsCpuParams``R/W
cpuparams_batchCpuParams``R/W
numaggml_numa_strategyGGML_NUMA_STRATEGY_DISABLEDR/WKV cache defragmentation threshold.

CVector Generator

PropertyTypeDefaultR/WDescription
n_pca_batchint100R/Wstart processing from this chunk
n_pca_iterationsint1000R/Wstart processing from this chunk

Control Vector

PropertyTypeDefaultR/WDescription
control_vector_layer_endint-1R/Wlayer range for control vector
control_vector_layer_startint-1R/Wlayer range for control vector

Embedding

PropertyTypeDefaultR/WDescription
cls_sepstr"\t"R/Wseparator of classification sequences
embd_normalizeint2R/Wnormalisation for embendings (-1=none, 0=max absolute int16, 1=taxicab, 2=euclidean, >2=p-norm)
embd_outstr""R/Wempty = default, "array" = [[],[]...], "json" = openai style, "json+" = same "json" + cosine similarity matrix
embd_sepstr"\n"R/Wseparator of embendings
embeddingboolfalseR/Wget only sentence embedding

GPU / Offloading

PropertyTypeDefaultR/WDescription
fit_paramsbooltrueR/Wwhether to fit unset model/context parameters to free device memory
fit_params_min_ctxint4096R/Wminimum context size to set when trying to reduce memory use
fit_params_printboolfalseR/Wprint the estimated required memory to run the model
fit_params_targetlist[int]std::vector<size_t>(llama_max_devices(), 1024 * 1024*1024)R/Wmargin per device in bytes for fitting parameters to free memory
main_gpuint0R/Wthe GPU that is used for scratch and small tensors
n_gpu_layersint-1R/Wnumber of layers to store in VRAM, -1 is auto, <= -2 is all
no_extra_buftsboolfalseR/Wdisable extra buffer types (used for weight repacking)
no_hostboolfalseR/Wbypass host buffer allowing extra buffers to be used
no_kv_offloadboolfalseR/Wdisable KV offloading
no_op_offloadboolfalseR/Wglobally disable offload host tensor operations to device
split_modellama_split_modeLLAMA_SPLIT_MODE_LAYERR/Whow to split the model across GPUs.
tensor_splitlist[float]{0}R/Whow split tensors should be distributed across GPUs.

IMatrix

PropertyTypeDefaultR/WDescription
compute_pplbooltrueR/Wwhether to compute perplexity
i_chunkint0R/Wstart processing from this chunk
imat_datint0R/Wwhether the legacy imatrix.dat format should be output (gguf <= 0 < dat)
n_out_freqint10R/Woutput the imatrix every n_out_freq iterations
n_save_freqint0R/Wsave the imatrix every n_save_freq iterations
parse_specialboolfalseR/Wwhether to parse special tokens during imatrix tokenization
process_outputboolfalseR/Wcollect data for the output tensor
show_statisticsboolfalseR/Wshow imatrix statistics per tensor

Inference

PropertyTypeDefaultR/WDescription
grp_attn_nint1R/Wgroup-attention factor.
grp_attn_wint512R/Wgroup-attention width.
n_batchint2048R/Wlogical batch size for prompt processing (must be >=32 to use BLAS)
n_chunksint-1R/Wmax number of chunks to process (-1 = unlimited).
n_ctxint0R/Wcontext size, 0 == context the model was trained with
n_keepint0R/Wnumber of tokens to keep from initial prompt.
n_parallelint1R/Wnumber of parallel sequences to decode.
n_predictint-1R/Wmax. number of new tokens to predict, -1 == no limit
n_printint-1R/Wprint token count every n tokens (-1 = disabled).
n_sequencesint1R/Wnumber of sequences to decode.
n_ubatchint512R/Wphysical batch size for prompt processing (must be >=32 to use BLAS)

LoRA

PropertyTypeDefaultR/WDescription
lora_adapterslist``R/WGet the list of LoRA adapters as a list of CommonAdapterLoraInfo objects.
lora_init_without_applyboolfalseR/Wonly load lora to memory, but do not apply it to ctx (user can manually apply lora later using llama_lora_adapter_apply).

Model

PropertyTypeDefaultR/WDescription
hf_tokenstr""R/WHF token (aka bearer token)
modelCommonParamsModel``R/W
model_aliasset[str]``R/Wmodel aliases
model_tagsset[str]``R/Wmodel tags (informational, not used for routing)

Multimodal

PropertyTypeDefaultR/WDescription
imagelist[str]``R/Wpath to image file(s) ; TODO: change the name to "media"
image_max_tokensint-1R/W
image_min_tokensint-1R/W
mmprojCommonParamsModel``R/W
mmproj_use_gpubooltrueR/Wuse GPU for multimodal model
no_mmprojboolfalseR/Wexplicitly disable multimodal model

Output / Logging

PropertyTypeDefaultR/WDescription
logits_filestr""R/Wfile for saving all logits
logits_output_dirstr"data"R/Wdirectory for saving logits output files
out_filestr``R/Woutput filename for all example programs
save_logitsboolfalseR/Wwhether to save logits to files
tensor_filterlist[str]``R/Wfilter tensor names for debug output (regex)
verbosityint3R/WLOG_LEVEL_INFO

Perplexity / Benchmarks

PropertyTypeDefaultR/WDescription
checkboolfalseR/Wcheck rather than generate results for llama-results
hellaswagboolfalseR/Wcompute HellaSwag score over random tasks from datafile supplied in prompt
hellaswag_tasksint400R/Wnumber of tasks to use when computing the HellaSwag score
kl_divergenceboolfalseR/Wcompute KL divergence
multiple_choiceboolfalseR/Wcompute TruthfulQA score over random tasks from datafile supplied in prompt
multiple_choice_tasksint0R/Wnumber of tasks to use when computing the TruthfulQA score. If 0, all tasks will be computed
ppl_output_typeint0R/W= 0 -> ppl output is as usual, = 1 -> ppl output is num_tokens, ppl, one per line
ppl_strideint0R/Wstride for perplexity calculations. If left at 0, the pre-existing approach will be used.
winograndeboolfalseR/Wcompute Winogrande score over random tasks from datafile supplied in prompt
winogrande_tasksint0R/Wnumber of tasks to use when computing the Winogrande score. If 0, all tasks will be computed

Prompt / Input

PropertyTypeDefaultR/WDescription
antipromptlist[str]``R/Wstrings upon which more user input is prompted (a.k.a. reverse prompts).
in_fileslist[str]``R/Wall input files.
input_prefixstr""R/Wstring to prefix user inputs with
input_prefix_bosboolfalseR/Wprefix BOS to user inputs, preceding input_prefix
input_suffixstr""R/Wstring to suffix user inputs with
path_prompt_cachestr""R/Wpath to file for saving/loading prompt eval state
promptstr""R/Wthe prompt text
prompt_filestr""R/Wstore the external prompt file name

Retrieval / Passkey

PropertyTypeDefaultR/WDescription
chunk_separatorstr"\n"R/Wchunk separator for context embedding
chunk_sizeint64R/Wchunk size for context embedding
context_fileslist[str]``R/Wcontext files to embed
i_posint-1R/Wposition of the passkey in the junk text
n_junkint250R/Wnumber of times to repeat the junk text

RoPE / YaRN

PropertyTypeDefaultR/WDescription
rope_freq_basefloat0.0R/WRoPE base frequency.
rope_freq_scalefloat0.0R/WRoPE frequency scaling factor.
rope_scaling_typellama_rope_scaling_typeLLAMA_ROPE_SCALING_TYPE_UNSPECIFIEDR/Wrope scaling type.
yarn_attn_factorfloat-1.0R/WYaRN magnitude scaling factor.
yarn_beta_fastfloat-1.0R/WYaRN low correction dim.
yarn_beta_slowfloat-1.0R/WYaRN high correction dim.
yarn_ext_factorfloat-1.0R/WYaRN extrapolation mix factor.
yarn_orig_ctxint0R/WYaRN original context length.

Server

PropertyTypeDefaultR/WDescription
api_keyslist[str]``R/Wlist of api keys
api_prefixstr""R/W
cache_idle_slotsbooltrueR/Wsave and clear idle slots upon starting a new task
cache_promptbooltrueR/Wwhether to enable prompt caching
cache_ram_mibint8192R/W-1 = no limit, 0 - disable, 1 = 1 MiB, etc.
chat_templatestr""R/Wchat template
default_template_kwargsdict``R/W
enable_chat_templatebooltrueR/Wenable chat template
enable_reasoningint-1R/W-1 = auto, 0 = disable, 1 = enable
endpoint_metricsboolfalseR/Wendpoint metrics
endpoint_propsboolfalseR/Wonly control POST requests, not GET
endpoint_slotsbooltrueR/Wendpoint slots
hostnamestr"127.0.0.1"R/Wserver hostname
log_jsonboolfalseR/Wlog json
media_pathstr``R/Wpath to directory for loading media files
models_autoloadbooltrueR/Wautomatically load models when requested via the router server
models_dirstr""R/Wdirectory containing models for the router server
models_maxint4R/Wmaximum number of models to load simultaneously
models_presetstr""R/Wdirectory containing model presets for the router server
n_cache_reuseint0R/Wmin chunk size to reuse from the cache via KV shifting
n_ctx_checkpointsint32R/Wmax number of context checkpoints per slot
n_threads_httpint-1R/Wnumber of threads to process HTTP requests (TODO: support threadpool)
portint8080R/Wserver listens on this network port
prefill_assistantbooltrueR/Wif true, any trailing assistant message will be prefilled into the response
public_pathstr""R/Wserver public_path
reasoning_formatcommon_reasoning_formatCOMMON_REASONING_FORMAT_DEEPSEEKR/W
sleep_idle_secondsint-1R/Wif >0, server will sleep after this many seconds of idle time
slot_prompt_similarityfloat0.1R/Wslot prompt similarity.
slot_save_pathstr``R/Wslot save path
ssl_file_certstr""R/Wssl file cert
ssl_file_keystr""R/Wssl file key
timeout_readint3600R/Whttp read timeout in seconds
timeout_writeinttimeout_readR/Whttp write timeout in seconds
use_jinjabooltrueR/W

Sub-params

PropertyTypeDefaultR/WDescription
diffusionCommonParamsDiffusion``R/Wcommon params diffusion.
samplingCommonParamsSampling``R/Wcommon params sampling.
speculativeCommonParamsSpeculative``R/Wcommon params speculative.
vocoderCommonParamsVocoder``R/Wcommon params vocoder.

Tensor Buffer Overrides

PropertyTypeDefaultR/WDescription
tensor_buft_overridesstr``R/W

Other

PropertyTypeDefaultR/WDescription
checkpoint_min_stepint8192R/Wminimum spacing between context checkpoints
force_pure_content_parserboolfalseR/Wforce pure content parser
models_preset_hfstr""R/Wshow a warning about remote presets on router loaded (if not empty)
mtmd_batch_max_tokensint1024R/W
n_outputs_maxint0R/Wmax outputs in a batch (0 = n_batch).
no_allocboolfalseR/WDon't allocate model buffers
path_prompts_log_dirstr""R/Wdirectory with logged prompts
reuse_portboolfalseR/Wallow multiple sockets to bind to the same port
server_toolslist[str]``R/Wenable built-in tools
sse_ping_intervalint30R/WSSE ping interval in seconds
system_promptstr""R/Wthe system prompt text
uibooltrueR/Wenable UI
ui_config_jsonstr``R/WUI config json
ui_mcp_proxyboolfalseR/WUI MCP proxy

CommonParamsDiffusion

Diffusion model parameters. Access via params.diffusion.

PropertyTypeDefaultR/WDescription
add_gumbel_noiseboolfalseR/Wadd gumbel noise to the logits if temp > 0.0
alg_tempfloat0.0R/Walgorithm temperature
algorithmint4R/Wdiffusion algorithm (0=ORIGIN, 1=MASKGIT_PLUS, 2=TOPK_MARGIN, 3=ENTROPY)
block_lengthint0R/Wblock length for generation
cfg_scalefloat0R/Wclassifier-free guidance scale
epsfloat0R/Wepsilon for timesteps
stepsint128R/Wnumber of diffusion steps
visual_modeboolfalseR/Wshow progressive diffusion on screen

CommonParamsModel

Model path and source parameters. Access via params.model.

PropertyTypeDefaultR/WDescription
docker_repostr``R/WDocker repo
hf_filestr""R/WHF file
hf_repostr``R/WHF repo
pathstr``R/Wmodel local path
urlstr""R/Wmodel url to download

CommonParamsSampling

Sampling parameters that control token generation strategy. Access via params.sampling.

PropertyTypeDefaultR/WDescription
adaptive_decayfloat0.90R/WEMA decay for adaptation; history ≈ 1/(1-decay) tokens (0.0 - 0.99)
adaptive_targetfloat-1.0R/Wselect tokens near this probability (valid range 0.0 to 1.0; negative = disabled)
backend_samplingbool``R/Wenable backend sampling
dry_allowed_lengthint2R/Wtokens extending repetitions beyond this receive penalty
dry_basefloat1.75R/W0.0 = disabled; multiplier * base ^ (length of sequence before token - allowed length)
dry_multiplierfloat0.0R/W0.0 = disabled; DRY repetition penalty for tokens extending repetition:
dry_penalty_last_nint-1R/Whow many tokens to scan for repetitions (0 = disable penalty, -1 = context size)
dynatemp_exponentfloat1.00R/Wcontrols how entropy maps to temperature in dynamic temperature sampler
dynatemp_rangefloat0.00R/W0.0 = disabled
generation_promptstr``R/WThe assistant generation prompt already prefilled into the prompt.
grammarCommonGrammar``R/Woptional grammar constraint (user / output-format / tool-calls)
ignore_eosboolfalseR/Wignore end-of-sentence
logit_biaslist[LlamaLogitBias]``R/Wlogit biases to apply
logit_bias_eoglist[LlamaLogitBias]``R/Wpre-calculated logit biases for EOG tokens
min_keepint0R/W0 = disabled, otherwise samplers should return at least min_keep tokens
min_pfloat0.05R/W0.0 = disabled
mirostatint0R/W0 = disabled, 1 = mirostat, 2 = mirostat 2.0
mirostat_etafloat0.10R/Wlearning rate
mirostat_taufloat5.00R/Wtarget entropy
n_prevint64R/Wnumber of previous tokens to remember
n_probsint0R/Wif greater than 0, output the probabilities of top n_probs tokens.
no_perfboolfalseR/Wdisable performance metrics
penalty_freqfloat0.00R/W0.0 = disabled
penalty_last_nint64R/Wlast n tokens to penalize (0 = disable penalty, -1 = context size)
penalty_presentfloat0.00R/W0.0 = disabled
penalty_repeatfloat1.00R/W1.0 = disabled
reasoning_budget_endlist[int]``R/Wend tag token sequence
reasoning_budget_forcedlist[int]``R/Wforced sequence (message + end tag)
reasoning_budget_messagestr``R/Wmessage injected before end tag when budget exhausted
reasoning_budget_startlist[int]``R/Wstart tag token sequence
reasoning_budget_tokensint``R/W-1 = disabled, >= 0 = token budget
reasoning_controlbool``R/Wcreate the budget sampler on demand so reasoning can be ended at runtime
samplersstr``R/Wget/set sampler types
seedintLLAMA_DEFAULT_SEEDR/Wthe seed used to initialize llama_sampler.
tempfloat0.80R/W<= 0.0 to sample greedily, 0.0 to not output probabilities
timing_per_tokenboolfalseR/W
top_kint40R/W<= 0 to use vocab size.
top_pfloat0.95R/W1.0 = disabled
typ_pfloat1.00R/Wtypical_p, 1.0 = disabled
user_sampling_configint0R/Wbitfield to track user-specified samplers
xtc_probabilityfloat0.00R/W0.0 = disabled
xtc_thresholdfloat0.10R/W> 0.5 disables XTC

CommonParamsSpeculative

Speculative decoding parameters. Access via params.speculative.

PropertyTypeDefaultR/WDescription
draftCommonParamsSpeculativeDraft``Rdraft-model-based speculative decoding parameters.
ngram_cacheCommonParamsSpeculativeNgramCache``Rngram cache parameters.
ngram_map_kCommonParamsSpeculativeNgramMap``Rngram map k parameters.
ngram_map_k4vCommonParamsSpeculativeNgramMap``Rngram map k4v parameters.
ngram_modCommonParamsSpeculativeNgramMod``Rngram mod parameters.
ngram_simpleCommonParamsSpeculativeNgramMap``Rngram simple map parameters.
typeslist[common_speculative_type]{ COMMON_SPECULATIVE_TYPE_NONE }R/Wtypes of speculative decoding.

CommonParamsVocoder

Text-to-speech (vocoder) parameters. Access via params.vocoder.

PropertyTypeDefaultR/WDescription
modelCommonParamsModel``R/W
speaker_filestr``R/Wspeaker file path

CpuParams

CPU threading and scheduling parameters. Access via params.cpuparams or params.cpuparams_batch.

PropertyTypeDefaultR/WDescription
cpumasklist[bool]``R/WCPU affinity mask: mask of cpu cores (all-zeros means use default affinity settings)
mask_validbool``R/WDefault: any CPU.
n_threadsint``R/Wnumber of threads.
polluint32_t``R/WPolling (busywait) level (0 - no polling, 100 - mostly polling)
priorityggml_sched_priority``R/WScheduling prio : (0 - normal, 1 - medium, 2 - high, 3 - realtime).
strict_cpubool``R/WUse strict CPU placement.