llm-inference-and-serving
Run, serve, and optimize LLMs: llama.cpp local inference, vLLM high-throughput serving, and abliteration with Obliteratus.
- License 许可
- MIT
- 最近更新
- 2026-11-06
- Stars
- ★ 5
- Forks
- 4
01 前言 Front Matter
- name
- llm-inference-and-serving
- author
- Hermes Agent
- license
- MIT
- version
- 1.0.0
- metadata
- { "hermes": { "tags": [ "llm", "inference", "vllm", "llama.cpp", "gguf", "serving", "obliteratus" ], "related_skills": [ "huggingface-hub" ] } }
- platforms
- [ "linux", "macos", "windows" ]
- description
- Run, serve, and optimize LLMs: llama.cpp local inference, vLLM high-throughput serving, and abliteration with Obliteratus.
02 资源文件 4
- 许可证LICENSE10.5 KB
- 参考文档references/ecosystem-map.md14.0 KB
- 参考文档SOURCE.md386 B
- 参考文档TRUST.auto.yaml2.2 KB
03 SKILL.md 正文
LLM Inference and Serving
Three distinct but related domains: local CPU/GPU inference with llama.cpp, high-throughput server deployment with vLLM, and model surgery (abliteration) with Obliteratus.
llama.cpp (Local GGUF Inference)
Setup
brew install llama.cpp # macOS (Metal)
# OR clone and build with CUDA / ROCm flags
Download Models
# Via huggingface-cli (preferred)
huggingface-cli download TheBloke/Llama-2-7B-GGUF llama-2-7b.Q4_K_M.gguf --local-dir ./models
# Via curl (direct)
curl -L -o ./models/model.gguf "<url>"
Run Inference
# Interactive chat
llama-cli -m ./models/model.gguf --color -c 4096 -p "You are a helpful assistant."
# Single completion
llama-cli -m ./models/model.gguf -p "The capital of France is" -n 32
# Server mode (OpenAI-compatible API)
llama-server -m ./models/model.gguf -c 4096 --port 8080
# Test: curl http://localhost:8080/v1/chat/completions -d '{"messages":[{"role":"user","content":"hello"}]}'
Key Flags
| Flag | Meaning |
|---|---|
-m |
Model path |
-c |
Context size |
-n |
Tokens to generate |
--color |
Syntax-highlight special tokens |
-ngl |
Number of GPU layers to offload |
--port |
Server port |
GGUF Quantization
# Convert HF model to GGUF
python convert_hf_to_gguf.py ./hf-model/ --outfile ./model.gguf --outtype q4_k_m
Quantization types (smaller = faster but less accurate): Q2_K, Q3_K_M, Q4_K_M, Q5_K_M, Q6_K, Q8_0, FP16
vLLM (High-Throughput Serving)
Setup
pip install vllm
Launch Server
python -m vllm.entrypoints.openai.api_server \
--model meta-llama/Llama-2-7b-hf \
--tensor-parallel-size 1 \
--port 8000
Client Usage (OpenAI-compatible)
from openai import OpenAI
client = OpenAI(base_url="http://localhost:8000/v1", api_key="dummy")
response = client.chat.completions.create(model="meta-llama/Llama-2-7b-hf", messages=[...])
Key Flags
| Flag | Meaning |
|---|---|
--tensor-parallel-size |
GPUs per model replica |
--pipeline-parallel-size |
Model replicas |
--max-model-len |
Max context length |
--quantization |
awq, gptq, squeezellm |
--enable-prefix-caching |
Automatic prompt caching |
Benchmark
python benchmarks/benchmark_throughput.py --model meta-llama/Llama-2-7b-hf --input-len 512 --output-len 128
Obliteratus (Abliteration)
Remove refusal behaviors from open-weight LLMs via diff-in-means abliteration.
Setup
pip install obliteratus
Run Abliteration
from obliteratus import abliterate
abliterate(
model_path="meta-llama/Llama-2-7b-hf",
output_path="./unhinged-llama-7b",
harm_categories=["illegal", "hate", "harassment"],
)
Post-Abliteration Verification
- Run a refusal test suite (e.g.,
jailbreakbenchmarks) - Check that helpfulness wasn't degraded on standard benchmarks
- Quantize to GGUF and test with llama.cpp if deploying locally
Common Pitfalls
- llama.cpp GPU layers:
-ngltoo high for your VRAM causes OOM; start at 99 and reduce if crashes - vLLM CUDA version: vLLM is tightly coupled to PyTorch CUDA version; use the exact wheel for your CUDA
- GGUF context size:
-clarger than model's training context causes gibberish; respect model card - Obliteratus ethics: Only abliterate models you own or have explicit license to modify; never redistribute without checking license terms
04 同仓库更多 Skills
blocked-page-recovery
Use when a fetch fails: 403/429, paywall, WAF, bot wall.
writing-plans
Use when creating or updating executable software plans. Keep plans as local files unless the user explicitly asks to register them in Doct.
test-driven-development
TDD: enforce RED-GREEN-REFACTOR, tests before code.
systematic-debugging
4-phase root cause debugging: understand bugs before fixing.
spike
Throwaway experiments to validate an idea before build.
simplify-code
Parallel 3-agent cleanup of recent code changes.