llama-cpp-python 0.3

Last reviewed Sep 19, 2026

Export as PDF

Prompt Details

Prompt Composition

2prompts
  1. Python 3155 lines · 3.8K tokens
  2. llama-cpp-python 0.359 lines · 2.4K tokens
Total214 lines · 6.1K tokens

CWE Coverage

  • 20
  • 23
  • 36
  • 59
  • 78
  • 79
  • 89
  • 95
  • 117
  • 201
  • 208
  • 209
  • 214
  • 250
  • 295
  • 306
  • 319
  • 328
  • 338
  • 347
  • 367
  • 379
  • 409
  • 416
  • 426
  • 427
  • 470
  • 502
  • 524
  • 532
  • 611
  • 674
  • 732
  • 770
  • 772
  • 776
  • 829
  • 862
  • 863
  • 916
  • 918
  • 942
  • 1104
  • 1284
  • 1333
  • 1336
  • 1395
  • 1426
  • 1427

Prompt Preview

Apply the Python 3 prompt first. These rules cover the llama-cpp-python 0.3 line and its python -m llama_cpp.server application, and were checked against 0.3.35. The package declares Python 3.8 or later; deploy on a maintained Python release and verify compatibility with the exact wheel, operating system, architecture, and accelerator backend.

Native artifacts and model acquisition

  • Pin the wheel or source build, bundled llama.cpp revision, and accelerator libraries together; review native GGUF, tokenizer, and RPC advisories as well as Python dependencies before deployment.
  • Provision models with hf_hub_download or snapshot_download using a full immutable commit in revision, then load verified local paths. In this version, Llama.from_pretrained and the server's hf_model_repo_id path do not forward a download revision; passing revision through constructor kwargs does not pin the download.
  • Verify every GGUF shard, LoRA adapter, projector, and tokenizer file against approved digests from trusted publishers; review embedded chat templates. Loading the first GGUF shard also loads the remaining shards; checking only the first file is insufficient.
  • Keep CONFIG_FILE, model, lora_path, clip_model_path, and hf_pretrained_model_name_or_path under operator control. Use read-only local artifact directories and provision Hugging Face tokenizers in advance so inference workers need no repository credentials or download access.
  • Protect LLAMA_CPP_LIB_PATH, MTMD_CPP_LIB, CMAKE_ARGS, and accelerator library search directories from caller influence.