gravity¶
Run large models on consumer hardware.
gravity is our fork of llama.cpp for running open models on consumer hardware, with the LoRA adapters that astro-weights makes. An adapter is a small course correction to a model, and when you measure one you need to know it was actually on, or actually off, for every request. Stock llama.cpp makes that easy to get wrong, so gravity adds sha256 file checks and, in eval mode, a receipt on every answer.
Two things we hit on stock llama.cpp (build b12359, Qwen3.5-9B Q4_K_M, Apple M3 Pro):
- A request without a
lorafield ran the adapter at full strength, even on a fresh server started with--lora-init-without-apply(5 of 5 test prompts). - With 4 parallel slots, only 3 of 20 answers matched the single-slot run byte for byte. With 1 slot, 20 of 20 matched.
What gravity adds¶
- Pinned files.
--model-sha256and--lora-sha256check the base model and each adapter before loading. A wrong file stops the server and names both hashes. - Eval mode.
--eval-modeturns on one slot and no prompt cache, starts every adapter at strength 0, and fills any missing sampling field with a fixed default. On our test model the base arm reran byte-identical, 20 of 20 answers, on a Mac (Metal) and on Linux (CUDA). See Measured. - Strict
loralists. Badloraentries get HTTP 400 instead of being ignored. - A receipt on every answer in eval mode. Each answer reports the strength and sha256 of every adapter, the model's sha256, which fields gravity filled or overrode, and the device that ran it.
Experimental, off by default¶
- MoE expert streaming (
--gravity-stream, with upstream's--moe-cache-mib). Expert weights missing from the GPU cache are read from the model file instead of host memory. Output is bit-identical with the flag on or off. Measured on one Mac, one model and one prompt so far (see Measured); no wider speed or memory claim. See Stream MoE experts.
Not built yet¶
These are on the roadmap, not in the code:
- Running models larger than memory with bounded RAM. Expert streaming reads from the file, but warmup and prompt processing still read experts through the mmap, so the page cache still fills.
- Windows builds.
- Measurements on more machines and models.
To build adapters for gravity, see the astro-weights library docs.