ODS V3 Pre-Release: Public testing and refinement ahead of the official V3 launch. Turn your PC, Mac, or Linux box into a private AI server.
llama-server
Core LLM inference engine for ODS
Overview
llama-server is the local LLM inference backend, powered by llama.cpp. It loads GGUF-format models and exposes an OpenAI-compatible HTTP API on port 8080. GPU acceleration is provided via CUDA (NVIDIA) or Vulkan and ROCm (AMD); CPU fallback is available for systems without a supported GPU.
All other services that perform AI inference — Open WebUI, LiteLLM, Privacy Shield, and the dashboard chat endpoint — connect to llama-server internally.
Features
- OpenAI-compatible API: Drop-in replacement for the OpenAI Chat Completions and Completions endpoints
- GGUF model support: Load any GGUF-quantized model from
data/models/ - GPU acceleration: CUDA (NVIDIA), and Vulkan or ROCm/HIP (AMD) backends
- Configurable context window: Token limit tunable via
CTX_SIZE - Prometheus metrics:
/metricsendpoint for throughput and token stats - Memory-aware GPU offload: llama.cpp selects the safe layer count by default; operators can override it with
N_GPU_LAYERS - Hardware-tier model selection: Installer auto-selects model size based on detected VRAM
Configuration
Environment variables (set in .env):
| Variable | Default | Description |
|---|---|---|
GGUF_FILE |
Qwen3.5-9B-Q4_K_M.gguf |
Model filename inside data/models/ |
CTX_SIZE |
16384 |
Context window size in tokens |
OLLAMA_PORT |
11434 |
External host port (maps to internal 8080) |
GPU_BACKEND |
nvidia |
GPU backend: nvidia or amd |
N_GPU_LAYERS |
auto |
GPU offload policy: auto, all, or a non-negative layer count |
LLAMA_ARG_FLASH_ATTN |
auto |
llama.cpp Flash Attention mode: auto, on, or off |
LLAMA_ARG_CACHE_TYPE_K |
f16 |
KV cache key precision. Use q8_0 to reduce long-context memory pressure |
LLAMA_ARG_CACHE_TYPE_V |
f16 |
KV cache value precision. Use q8_0 to reduce long-context memory pressure |
LLAMA_ARG_N_CPU_MOE |
unset | Optional MoE-only CPU expert offload (--n-cpu-moe). Leave unset for dense models |
LLAMA_SPEC_TYPE |
ngram-mod on the NVIDIA and CPU images |
Default speculative decoding when the model sets no LLAMA_ARG_SPEC_TYPE. Set none to turn it off. See N-gram speculative decoding |
LLAMA_ARG_SPEC_TYPE |
unset | Optional per-model speculative decoding mode (--spec-type), normally written by a runtime profile. Overrides LLAMA_SPEC_TYPE. Use only with supported GGUF/runtime combinations |
LLAMA_ARG_SPEC_DRAFT_N_MAX |
unset | Optional speculative draft token cap (--spec-draft-n-max; --draft-max on native macOS b8210) |
LLAMA_SERVER_MEMORY_LIMIT |
64G |
Docker memory limit for the container |
Long-context profile
For larger context windows on memory-constrained GPUs, keep the model unchanged and tune the attention/KV cache first:
CTX_SIZE=32768
LLAMA_ARG_FLASH_ATTN=on
LLAMA_ARG_CACHE_TYPE_K=q8_0
LLAMA_ARG_CACHE_TYPE_V=q8_0
This is opt-in. The defaults remain auto Flash Attention and f16 KV cache to preserve existing behavior.
MoE expert offload
For Mixture-of-Experts GGUF models, llama.cpp can keep the first N MoE expert layers on CPU/RAM:
LLAMA_ARG_N_CPU_MOE=25
Tune this value per machine. Lower values keep more work on GPU and can be faster if enough VRAM is available; higher values reduce VRAM pressure. Leave this unset for dense models.
N-gram speculative decoding
On the NVIDIA and CPU images and on native macOS, ODS starts llama-server with --spec-type ngram-mod (set through LLAMA_ARG_SPEC_TYPE in Docker). llama.cpp drafts tokens by matching n-grams already in the context, and the model verifies every draft before it is emitted. The output is still the model's own, so this is lossless. It speeds up requests that repeat the context: file edits, whole-file rewrites and quoting.
On an RTX 5090 with Qwen3.5-27B Q4_K_M and llama.cpp b9014:
| Workload | Without | With ngram-mod |
|---|---|---|
| Copy-heavy edit of a 6.1k-token file | 89.5 s | 13.3 s |
| Whole-file rewrite, prior file in context as raw text | 70.1 s | 15.6 s |
| Same rewrite, prior file JSON-escaped in context | 70.3 s | 60.6 s |
| Novel generation and 24k-token prefill | no change (±0.5%) | no change (±0.5%) |
VRAM did not change.
On a Mac mini M4 (16 GB) with Qwen3.5-9B Q4_K_M and native b9014 (median of 3, every output exact):
| Workload | b8210 (previous pin) | b9014, LLAMA_SPEC_TYPE=none |
b9014, ngram-mod |
|---|---|---|---|
| Copy-heavy edit of a 2.0k-token file | 158.2 s | 135.6 s | 41.1 s |
| Whole-file rewrite, prior file raw | 155.6 s | 133.8 s | 49.0 s |
| Same rewrite, prior file JSON-escaped | 152.8 s | 131.2 s | 116.5 s |
Drafts were accepted at 84%, 72% and 57% respectively. Peak llama-server RSS was 8.5 GB with ngram-mod and 8.2 GB without.
Draft sizes keep llama.cpp's defaults (--spec-ngram-mod-n-match 24, --spec-ngram-mod-n-min 48, --spec-ngram-mod-n-max 64).
To turn it off, add this to .env and restart llama-server:
LLAMA_SPEC_TYPE=none
A model runtime profile that sets LLAMA_ARG_SPEC_TYPE (for example draft-mtp) takes precedence over LLAMA_SPEC_TYPE.
The default applies only where the pinned llama.cpp build has the benchmarked implementation: the dedicated ngram-mod parameters (b8955 and later) and speculative checkpoints for hybrid models such as Qwen3.5 (b8842 and later).
| Runtime | llama.cpp | Default |
|---|---|---|
NVIDIA Docker (docker-compose.nvidia.yml) |
b9014 | ngram-mod |
CPU Docker (docker-compose.cpu.yml) |
b9014 | ngram-mod |
| Native macOS Metal | b9014 (installs from before this pin keep b8210) | ngram-mod when the installed binary supports it; none on b8210 |
AMD Docker (docker-compose.amd.yml, Vulkan; docker-compose.amd-rocm.yml adds ROCm) |
b9014 | none (not measured on AMD) |
Intel Docker (docker-compose.intel.yml, started by hand; the installer uses docker-compose.arc.yml) |
b9014 | none (not measured on Intel) |
Intel Arc local build (docker-compose.arc.yml) |
source default b9014; the installer does not build this image, and b9014 has not been built on its oneAPI 2025.0.0 base | none |
Apple Docker (docker-compose.apple.yml) |
b9014 | none |
| Native Windows llama-server (Vulkan fallback) | b9014 for fresh installs; existing installs keep b8248 until <install>\llama-server is deleted and the installer re-run |
none (not measured on Windows) |
| Registered native model-store profiles | qualified executable | none; the profile keeps its own argument list |
Builds b8210 and b8248 accept --spec-type ngram-mod, but they predate both changes. They draft with the generic 12-token lookup, which upstream logs as too small, and they turn speculation off for hybrid models. Remote and cloud providers never start llama-server.
Native macOS runtime arguments
Native macOS keeps the llama-server binary it was installed with, so an older install can still run b8210 after ODS moves its pin. Before a running model is stopped, every macOS launcher (installer, ods-macos.sh, the bootstrap full-model swap and dashboard model switches) passes the settings below through installers/macos/lib/native-checkpoint-args.py. That helper reads the binary's own --help and:
- spells the draft settings for that binary.
LLAMA_ARG_SPEC_DRAFT_N_MAXbecomes--spec-draft-n-maxon b9014 and--draft-maxon b8210, which rejects the newer name.LLAMA_ARG_SPEC_DRAFT_TYPE_K/_Vwork the same way. - adds
--ctx-checkpoints 32unlessLLAMA_ARG_CTX_CHECKPOINTSis set. b8210 keeps 8 prompt checkpoints per slot, so changing a tool result more than 8 turns back re-processes the whole prompt. On a Mac mini M4 (16 GB) with Qwen3.5-9B and b8210, editing turn 3's result after 12 tool turns took 84.3 s with 8 checkpoints and 33.4 s with 32. b9014 already defaults to 32. Each checkpoint costs about 50 MiB for this model. Set a lower value, or 0, to save memory. - adds
--spec-type ngram-modwhen the binary has the b8955+ implementation,LLAMA_ARG_SPEC_TYPEis unset andLLAMA_SPEC_TYPEis notnone. - passes
LLAMA_REASONING(defaultoff) as--reasoningwhen the binary has that switch, and leaves--reasoning-formatat llama.cpp's default, as Docker does withLLAMA_ARG_REASONING. On the Mac mini with b9014, the old native flags (--reasoning-format noneonly) left--reasoningatauto: the server loggedthinking = 1and returned its reasoning as the reply. With--reasoning offbut--reasoning-format none, every reply, tool calls included, started with an empty<think>block.--reasoning offwith the default format replied exactly as b8210 did. b8210 has no--reasoningswitch, so it keeps--reasoning-format none.
A setting you add to .env that the binary cannot honour stops the restart before the running model is touched. The bootstrap full-model swap instead logs a warning and starts the full model without the tuning. A default the binary does not support is left out. A fresh install, or get-ods.sh --force, installs the pinned b9014.
MTP speculative decoding
Newer llama.cpp builds support MTP speculative decoding for GGUFs that include compatible MTP data. ODS exposes the flags but does not enable them automatically, because normal GGUFs and older llama.cpp builds will reject or ignore these settings.
LLAMA_ARG_SPEC_TYPE=draft-mtp
LLAMA_ARG_SPEC_DRAFT_N_MAX=3
Use this only with a llama.cpp image or native binary built after MTP support landed, and with a model family that explicitly publishes MTP-capable GGUFs. Normal GGUFs without MTP layers should leave these variables unset.
In router or multi-model setups, do not put MTP settings in a shared default section when any routed model lacks MTP layers. Apply spec-type = draft-mtp and spec-draft-n-max = 3 only to the MTP-capable model section so non-MTP models keep loading normally.
In Docker, set the draft model's KV cache types with LLAMA_ARG_SPEC_DRAFT_CACHE_TYPE_K and LLAMA_ARG_SPEC_DRAFT_CACHE_TYPE_V, the names llama.cpp reads. Native macOS and Windows launchers take LLAMA_ARG_SPEC_DRAFT_TYPE_K/_V and pass them as --spec-draft-type-k/-v. llama.cpp has no env variable by that name, so Docker ignores it.
Image pins
Every llama.cpp image ODS ships is pinned by tag and sha256 digest, for example ghcr.io/ggml-org/llama.cpp:server-cuda-b9014@sha256:fcf28582…55c4f. llama.cpp publishes a ghcr tag for only some of its builds, and ODS once pinned a tag that was never published. The digest also means a re-pushed tag cannot change what an install runs. scripts/check-dependency-pins.py rejects a llama.cpp image without a digest, and tests/contracts/test-llama-cpp-compat.py checks that every copy of a pin (Compose, installer pulls, tier maps, host agent, model catalog) agrees.
| Artifact | Pin |
|---|---|
server-cuda-b9014 (NVIDIA, multi-arch) |
sha256:fcf285820892e7ce3218379634e3590826fc697e8b6745b9392072462e355c4f |
server-cuda13-b11429 (NVIDIA compute capability 12.1: DGX Spark GB10, RTX Spark N1X; multi-arch, from config/backends/nvidia.json) |
sha256:9d6ca9a08b5e0c0a6d2560bff7d4c76bdf946776bbde6a20d9d6403594d93a9f |
server-b9014 (CPU, multi-arch) |
sha256:2e7953dfef88f302bf0683bffa7dc1f8d86ef75910380bc41126ec5b8bedaf53 |
server-intel-b9014 (Intel) |
sha256:9c7bbaad3663523a3deb8927d3cfbf58d33f00a7634c69843e9eeeda01568c1b |
server-b9014 (Apple Docker; same image as CPU) |
sha256:2e7953dfef88f302bf0683bffa7dc1f8d86ef75910380bc41126ec5b8bedaf53 |
server-vulkan-b9014 (AMD default, multi-arch) |
sha256:15c30b560d61ead1e08bee837503203a776fd968736118e313240c32157fd973 |
server-rocm-b9014 (AMD with AMD_INFERENCE_BACKEND=rocm, amd64) |
sha256:68403f82fe496302bb1c681bab2ee569a04cc13da8fcf14456376b485562236d |
llama-b9014-bin-win-vulkan-x64.zip (native Windows) |
SHA-256 6cd4bc7a44256e674458b0c5ea2ae3461dca29ee87876c8d410ecc78652a3b0f |
Intel Arc local build (images/llama-sycl, source default; not built or tested) |
tag b9014, commit d4b0c22f9e67f0295e91dc1ab4f17c0fb2557fa4 |
To use another build, set LLAMA_SERVER_IMAGE to a tag@sha256:digest reference. docker buildx imagetools inspect <image> prints the digest of a tag. The AMD overlays do not read LLAMA_SERVER_IMAGE: model profiles can set it to the CUDA image, which would run without the GPU on AMD.
On an NVIDIA GPU of compute capability 12.1 (DGX Spark GB10, RTX Spark N1X), llama.cpp's CUDA 12 images (server-cuda-*, server-cuda12-*) load but answer with ????: they have no kernels for that GPU. The installer records the GPU's GPU_COMPUTE_CAP in .env and writes the server-cuda13 pin above as LLAMA_SERVER_IMAGE instead, and the host agent does the same on Models-page switches and rollbacks. An image you set that is not a CUDA 12 llama.cpp build is kept.
llama.cpp env names
llama-server reads only the LLAMA_ARG_* names defined in its common/arg.cpp, and ignores any other name without a warning. tests/contracts/test-llama-spec-default.py keeps the names that the NVIDIA and CPU containers receive in step with the pinned build.
LLAMA_ARG_NO_CACHE_PROMPTworks on b9014 and later.--cache-promptis a negatable flag, so llama.cpp also reads theLLAMA_ARG_NO_form, and any value, even0, disables prompt caching.LLAMA_ARG_CHECKPOINT_EVERY_N_TOKENSnever existed in llama.cpp. The flag--checkpoint-every-n-tokensreadsLLAMA_ARG_CHECKPOINT_EVERY_NT.- llama.cpp b9310 removed
--checkpoint-every-n-tokens(LLAMA_ARG_CHECKPOINT_EVERY_NT) and added--checkpoint-min-step(LLAMA_ARG_CHECKPOINT_MIN_SPACING_NT), a minimum spacing rather than a fixed interval. Docker passes both names through, and each build reads only its own. Native Windows passes the interval only when the installedllama-server --helplists the flag, because llama-server exits on a flag it does not know. - Native Windows passes
LLAMA_REASONINGas--reasoningwhen the installedllama-server --helplists it (b9014), and as--reasoning-formatotherwise (b8248), adding--reasoning-budget 0foroff. b9014 defaults--reasoningtoauto, and--reasoning-format nonealone returns the reasoning inside the reply. On b8248 only--reasoning-budget 0turns thinking off: with Qwen3.5-2B on the b8248 image,--reasoning-format nonealone answered with 105 tokens of reasoning in the reply, and adding--reasoning-budget 0answered42(the server logsthinking = 0). - Intel images: ODS does not set
SYCL_CACHE_PERSISTENT, which crashes llama-server with the oneAPI 2025.3 runtime in the b9014 image (ggml-org/llama.cpp#21474, #22095). On hosts with more than one Intel GPU, setONEAPI_DEVICE_SELECTOR=level_zero:0(ggml-org/llama.cpp#21747). - On NVIDIA, ODS uses
--split-mode layerfor every multi-GPU assignment. llama.cpp b9890 removed CUDA row split:--split-mode rowstill parses, but the model fails to load.
AMD-specific variables
| Variable | Default | Description |
|---|---|---|
VIDEO_GID |
44 |
GID of the video group (getent group video | cut -d: -f3) |
RENDER_GID |
992 |
GID of the render group (getent group render | cut -d: -f3) |
AMD_INFERENCE_BACKEND |
vulkan |
vulkan (default) or rocm. rocm adds docker-compose.amd-rocm.yml; the installer selects it for Instinct cards, which have no Vulkan |
HSA_OVERRIDE_GFX_VERSION |
unset | ROCm only. The installer sets it only for GPUs the ROCm image was not built for |
API Endpoints
llama-server exposes an OpenAI-compatible REST API:
| Method | Path | Description |
|---|---|---|
GET |
/health |
Health check |
GET |
/metrics |
Prometheus inference metrics |
POST |
/v1/chat/completions |
Chat completions (OpenAI format) |
POST |
/v1/completions |
Text completions |
GET |
/v1/models |
List loaded models |
Example
curl http://localhost:11434/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "default",
"messages": [{"role": "user", "content": "Hello!"}]
}'
Architecture
┌─────────────────────────────────────────────────────────┐
│ docker-compose.base.yml (GPU-agnostic command + ports) │
│ + │
│ docker-compose.nvidia.yml OR docker-compose.amd.yml │
│ (image + GPU device passthrough) │
└──────────────────────────┬──────────────────────────────┘
│
┌──────▼──────────┐
│ llama-server │
│ (llama.cpp) │
│ :8080 (int) │
│ :11434 (ext) │
└──────┬──────────┘
│ OpenAI-compatible API
┌────────────────┼──────────────────┐
│ │ │
┌─────▼─────┐ ┌──────▼───────┐ ┌──────▼──────┐
│ Open WebUI│ │ LiteLLM │ │Privacy Shield│
└───────────┘ └──────────────┘ └─────────────┘
Files
manifest.yaml— Service metadata and feature definitions
Troubleshooting
Container not starting:
docker compose ps llama-server
docker compose logs llama-server
Model not found:
- Confirm the GGUF file exists:
ls ods/data/models/ - Check
GGUF_FILEin.envmatches the filename exactly
Out of VRAM:
- Reduce
CTX_SIZEin.env(try8192or4096) - Use a smaller quantized model (Q4 instead of Q8)
AMD GPU not detected:
- Verify group IDs:
getent group video | cut -d: -f3andgetent group render | cut -d: -f3 - Update
VIDEO_GIDandRENDER_GIDin.env - Confirm
/dev/driexists on the host, and/dev/kfdtoo withAMD_INFERENCE_BACKEND=rocm
Check inference metrics:
curl http://localhost:11434/metrics
License
Part of ODS — Local AI Infrastructure