Quickstart¶
Install gravity, run Qwen 3.5 9B with our terse edit in one command, run any GGUF model, then set up the same edit by hand. The gravity run commands on this page were run with gravity 0.1.5, the rest with gravity 0.1.4, on a Mac with an Apple M3 Pro.
1. Install¶
With Homebrew:
Or with the install script, which needs no sudo:
Both give you one command, gravity: gravity run downloads and serves a published adapter, gravity serve runs the server and gravity cli runs the terminal chat. gravity serve and gravity cli pass their arguments to gravity's llama-server and llama-cli. Prebuilt packages are for macOS on Apple silicon and, since 0.1.6, Linux x86_64 (CPU only). Install has the details, and Build from source covers other platforms.
2. Run Qwen 3.5 9B terse¶
glitch401/qwen3.5-9B-terse is Qwen3.5-9B with five weight matrices edited so that it answers math problems with fewer tokens. The model card reports -10.0% tokens on its MATH-500 confirm split. The saving does not carry over everywhere: on the full GSM8K test set the card reports -2.05 pp accuracy. Read the card before you rely on it.
One command downloads the model and the adapter, then serves them:
It fetches the base model (unsloth's Qwen3.5-9B Q4_K_M GGUF, 5.7 GB) and the adapter (0.3 MB) from Hugging Face at fixed commits, checks each file's sha256 before using it, and starts the server with the adapter on at strength 1. Before the server starts it prints:
Model: Qwen3.5-9B-Q4_K_M.gguf (sha256 03b74727a860a56338e042c4420bb3f04b2fec5734175f4cb9fa853daf52b7e8)
Adapter: qwen3.5-9B-terse-lora.gguf (sha256 a518c0c21ded983875039c32e6540d04bac2109dabb77eb4a18e5e929dacccc6), strength 1
Open http://127.0.0.1:8080 in a browser, or send OpenAI chat requests there
Arguments after -- go to llama-server. Without --port, gravity listens on 9931. Downloads stay in ~/Library/Caches/gravity (GRAVITY_CACHE sets another folder), so the next run skips them, and an interrupted download resumes.
To list every name, with its download sizes and model card:
qwen3.5-9b-terse 5.7 GB base + 0.3 MB adapter https://huggingface.co/glitch401/qwen3.5-9B-terse
gemma-4-e4b-terse 5.0 GB base + 0.4 MB adapter https://huggingface.co/glitch401/gemma-4-E4B-terse
To compare answers with the edit on and off, start in eval mode:
The adapter then starts at strength 0 until a request sets lora, and every answer carries a receipt. The requests and the receipt are in step 4, option B.
gravity run is in the prebuilt macOS package since 0.1.5 and the Linux package since 0.1.6. A source build has no gravity command, so use step 4 there.
3. Run any GGUF¶
Start the server:
-ngl 99 puts every layer on the GPU. Always pass --port: without it, gravity listens on 9931.
The server speaks the OpenAI chat API:
curl http://127.0.0.1:8080/v1/chat/completions \
-H 'Content-Type: application/json' \
-d '{"messages": [{"role": "user", "content": "What is 17 * 23?"}], "max_tokens": 1024}'
For the web UI, open http://127.0.0.1:8080 in a browser. The prebuilt macOS package includes it since 0.1.3.
To download a model from Hugging Face and serve it in one step, give the repository instead of a file:
The form is -hf <user>/<model>[:quant]. The file goes into the Hugging Face cache (~/.cache/huggingface/hub).
To ask one question in the terminal:
Leave out -p and -st to get an interactive chat. /exit ends it.
4. Run Qwen 3.5 9B terse by hand¶
Download the files yourself to pick the exact file or flags. The downloads below use the hf command from Hugging Face.
A. One merged file¶
hf download glitch401/qwen3.5-9B-terse qwen3.5-9B-terse-Q4_K_M.gguf --local-dir .
gravity serve -m qwen3.5-9B-terse-Q4_K_M.gguf -ngl 99 -c 8192 --port 8080
This is the configuration the card evaluated, with the port added. The edit is always on.
B. Base model plus adapter¶
This way the edit can be switched on and off per request, and every answer says which one it got.
hf download unsloth/Qwen3.5-9B-GGUF Qwen3.5-9B-Q4_K_M.gguf --local-dir .
hf download glitch401/qwen3.5-9B-terse qwen3.5-9B-terse-lora.gguf --local-dir .
gravity serve -m Qwen3.5-9B-Q4_K_M.gguf --lora qwen3.5-9B-terse-lora.gguf \
--model-sha256 03b74727a860a56338e042c4420bb3f04b2fec5734175f4cb9fa853daf52b7e8 \
--lora-sha256 a518c0c21ded983875039c32e6540d04bac2109dabb77eb4a18e5e929dacccc6 \
--eval-mode -np 1 -ngl 99 -c 8192 --port 8080
Both hashes come from the model card. gravity checks the two files against them before loading and refuses to start on a mismatch.
In eval mode the adapter starts at strength 0. Send a lora list to turn the edit on:
curl http://127.0.0.1:8080/v1/chat/completions \
-H 'Content-Type: application/json' \
-d '{"messages": [{"role": "user", "content": "What is 17 * 23?"}], "max_tokens": 1024, "lora": [{"id": 0, "scale": 1}]}'
And the same request with the edit off:
curl http://127.0.0.1:8080/v1/chat/completions \
-H 'Content-Type: application/json' \
-d '{"messages": [{"role": "user", "content": "What is 17 * 23?"}], "max_tokens": 1024, "lora": [{"id": 0, "scale": 0}]}'
Each answer carries a gravity object, the receipt. Its lora list reports the strength that ran. With scale 1:
"lora": [{"id": 0, "scale": 1.0, "sha256": "a518c0c21ded983875039c32e6540d04bac2109dabb77eb4a18e5e929dacccc6"}]
With scale 0:
"lora": [{"id": 0, "scale": 0.0, "sha256": "a518c0c21ded983875039c32e6540d04bac2109dabb77eb4a18e5e929dacccc6"}]
A request with no lora field runs at scale 0, and the receipt says so. Flags and fields lists the rest of the receipt.
5. Run your own adapter¶
Evaluate an adapter shows how to export an adapter with astro-weights, pin it, and run both arms.