Skip to content

What gravity adds over llama.cpp

Everything below is built and tested. Full server docs: tools/server/README.md.

  • File hash pins (--model-sha256, --lora-sha256). The server hashes the files at startup. On a mismatch it prints sha256 mismatch for ...: expected X, actual Y and exits before it loads anything. Why: a result is only tied to an adapter if the file is the one you think it is. Pins do not cover split models or router mode. Without pins the server warns not pinned and starts as before.
  • Strict per-request lora. Malformed lists return HTTP 400 (not an array, entry not an object, missing or non-integer id, id outside the loaded adapters, missing or non-numeric scale, unknown key, duplicate id). The same check runs on POST /lora-adapters. Why: upstream silently ignores a bad entry, so an adapter you thought was on could be off.
  • Eval mode (--eval-mode). One slot, no prompt cache, no continuous batching, every global adapter scale starts at 0. On /completion, /completions, /v1/completions and /v1/chat/completions, each absent field is filled with a fixed default (seed 0, temperature 0, samplers ["top_k","temperature"], top_k 1, lora = every adapter at scale 0) and its name is listed in the response. cache_prompt: true is forced to false. Routes that could run the model without these defaults (for example POST /lora-adapters, /infill, /v1/messages, embeddings) return HTTP 400. Why: both arms of a comparison run under the same fixed settings, and the arm is always explicit.
  • gravity provenance object. In eval mode every response from the four routes above carries gravity (in the final chunk when streaming). Fields: eval_mode, version (gravity release), build (upstream llama.cpp build), devices_available, devices_used, device_info, layers_on_device, output_device, model_sha256, lora (id, scale, sha256 per adapter), seed, temperature, samplers, filled, overridden. Outside eval mode responses stay exactly as upstream; GET /props always has the object. Why: the answer itself says which files, which strengths and which settings made it.
  • Device info. devices_used (device names the model's layers run on), layers_on_device (layer count per device), output_device, and device_info (ggml description and total memory in MiB per used device, so you can tell which card ran). Why: devices_available alone does not show where the model ran.
  • Slot cache clear on global lora change. A request without lora after one with lora no longer reuses a prompt cache computed under the other adapter setting. This is upstream's fix (llama.cpp #30367, commit 58a4a6b49), cherry-picked onto v1.0.0.
  • --lora-init-without-apply scale fix. On v1.0.0 the flag left every adapter scale at 1.0. In gravity the global scales really start at 0, so a request without lora runs the base model.