fix(llm-inference): switch serve phase from vLLM+bitsandbytes to llama.cpp+GGUF

bitsandbytes peak RAM ~54GB (bf16 load before quantize) — kills 40GB OptiPlex.
llama.cpp Q4_K_M GGUF loads pre-quantized: peak RAM ~15.5GB, fits cleanly.

Changes:
- serve.yml: build llama.cpp with CUDA, download Q4_K_M GGUF from bartowski,
  disable vllm-serve, deploy llama-server.service
- llama-server.service.j2: OpenAI-compatible server on same port 8000,
  --n-gpu-layers 99 (full GPU offload), --parallel 4, gemma chat template
- defaults: llm_gguf_dir, llm_gguf_path, llm_gpu_layers, llm_parallel_slots
- handlers: restart llama-server, vllm-serve failed_when=false (may not exist)

GGUF: bartowski/gemma-2-27b-it-Q4_K_M.gguf (15.5GB, 24GB VRAM fits w/ ~8GB headroom)
This commit is contained in:
Hermes Agent service account
2026-08-03 12:37:03 -05:00
parent 22a020e4c7
commit aa8e229e64
4 changed files with 128 additions and 19 deletions

View File

@@ -17,12 +17,19 @@ llm_venv_owner: jarvis
llm_hf_cache_dir: /home/jarvis/.cache/huggingface
llm_hf_model: google/gemma-2-27b-it
# vLLM serve
# vLLM serve (deprecated — replaced by llama-server)
# llama-server serve
llm_serve_port: 8000
llm_serve_host: "0.0.0.0"
llm_quantization: "bitsandbytes" # int4 — fits 27B in 24GB VRAM (~14GB vs ~54GB bf16)
llm_gpu_memory_utilization: "0.92" # higher utilization to give KV cache room
llm_max_model_len: 4096 # safe ceiling given 15.96GB model + int4
llm_max_model_len: 8192
llm_gpu_layers: 99 # offload all layers to GPU
llm_parallel_slots: 4 # concurrent request slots
llm_gguf_dir: /home/jarvis/models
llm_gguf_path: /home/jarvis/models/gemma-2-27b-it-Q4_K_M.gguf
# Legacy vLLM vars (kept for role documentation, not used by llama-server)
llm_quantization: "bitsandbytes"
llm_gpu_memory_utilization: "0.92"
# Monitoring
llm_gpu_exporter_version: "1.13.1"