llama.cppSetup

llama.cpp Guide: Run, Serve and Quantise Models Yourself

Use llama.cpp directly: prebuilt binaries, llama-cli and llama-server, GPU offload and context flags, KV cache quantisation and making your own GGUFs.

By the Uncensored AI Model Hub editorial team· Updated · 3 min read

llama.cpp is the engine under much of local AI. Using it directly gives you every option.

Get it

Download a prebuilt release for your platform and backend (CUDA, Vulkan, Metal, CPU), or build from source.

Run a server

llama-server -m ./model.Q4_K_M.gguf -c 16384 -ngl 99 --port 8080
  • -m: model file.
  • -c: context length.
  • -ngl: GPU layers (99 means as many as possible).
  • --port: server port.

Open the built-in web UI, or connect apps to the OpenAI-compatible API. See local OpenAI-compatible server.

Useful options

  • Flash attention for speed and memory.
  • KV cache quantisation (for example q8_0) to fit longer contexts.
  • CPU expert offload for MoE models.

Make your own GGUF

Convert a Hugging Face safetensors model with the conversion script, then quantise, optionally with an importance matrix. See GGUF vs safetensors.

Compare

llama.cpp vs Ollama.

Common questions

How do I start llama-server?

Run llama-server with -m pointing to a GGUF, set context with -c and GPU layers with -ngl. It serves a web UI and API on a local port.

What does -ngl do?

It sets how many layers are offloaded to the GPU. Use a high number to offload all layers if memory allows.

Can llama.cpp run on CPU only?

Yes. It was designed for CPUs and runs small and medium models at usable speeds on modern processors.

Related reading

Browse more: all guides · comparisons · glossary · free tools

Find your model in minutes.

Search the directory, check the licence and hardware, and start running uncensored AI models today.