Skip to content

Evaluate an adapter with astro-weights

Serve the base GGUF and the adapter GGUF on one server. Pin both files. Built from source, run build/bin/llama-server in place of gravity serve. Eval mode forces one slot (-np 1), which is what gives byte-identical reruns.

astro-weights export ADAPTER_DIR --gguf adapter.gguf --arch qwen35   # prints the adapter sha256
shasum -a 256 base.gguf                                              # base sha256
gravity serve -m base.gguf --lora adapter.gguf \
  --model-sha256 BASE_SHA256 --lora-sha256 ADAPTER_SHA256 \
  --eval-mode -np 1 -ngl 99 --port 8080

Then run both arms with astro-weights' HTTP runner. The arm is the lora scale in extra_body. arm_keys=["lora"] tells the header check that the arms may differ only there. Declare the server flags in serving_flags, because the client cannot read them.

from astro_weights.eval import check_headers, grade_exact, header_path, write_header
from astro_weights.runners.endpoint import generate_records_http, run_header_http

URL, NAME = "http://127.0.0.1:8080", "base.gguf"
FLAGS = {"--eval-mode": "on", "--parallel": "1"}
items = [{"item_id": "i0", "prompt": "Say w5.", "gold": "w5"}]
headers = {}
for arm, scale in [("base", 0), ("edit", 1)]:
    extra_body = {"lora": [{"id": 0, "scale": scale}]}  # explicit, base arm too
    headers[arm] = run_header_http(URL, NAME, 64, 0, extra_body, serving_flags=FLAGS)
    write_header(header_path(f"{arm}-http.jsonl"), headers[arm])
    generate_records_http(
        URL, NAME, items, arm, grade_exact, 64, extra_body=extra_body, out=f"{arm}-http.jsonl"
    )
check_headers(headers["base"], headers["edit"], arm_keys=["lora"])

Then run astro-weights eval base-http.jsonl edit-http.jsonl --ignore-header. Each response also has gravity.lora[].scale and the sha256 values, so you can check after the fact that the arms ran as intended. See the astro-weights docs (docs/how-to/run-eval.md) for the rest of the runner.