Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Engine reference — generated from the canonical engineering source. Do not edit this page by hand.

Local Inference Runbook

Status: LIVE. Operator procedures for the local inference lanes. The catalog of lanes, pins, use_case facets and measured numbers lives in local-inference-lanes.md; the machine ledger and validation semantics live in local-inference-benchmark.md.

0. Prerequisites

A running Sol with the lane registry (the shipped configs carry it; the active lane/engine set is inference_lanes + inference_engines). An admin token for start/stop/validate surfaces (inference:list is enough for the read-only lane query). Local lanes run on the node that owns the GPU/CPU — there is no remote lane start; remote capacity is the API tier.

Two architecture rules to keep in mind:

  1. Sol owns llama.cpp. Lanes are started, leased and reaped by Sol (sol_inference via erlexec); Luna consumes a Sol-issued grant. A worker never defines, probes or configures a lane endpoint.
  2. A row without a needle gate is not a row. Validation needs a fresh exact-recall needle row on the lane’s engine+host; ghost-imported measurements are evidence, never validation.

1. Status and inventory

zerg status
zerg ps
curl -s http://127.0.0.1:21434/api/v1/inference/lanes

The lanes response is the operator truth: per lane it projects kind, production, the engine, the loaded/running state, the current lease, use_case (the registry facet, joined at the read boundary) and validation.state + reason. A lane that is unvalidated will refuse a production start with {engine_unvalidated, Lane, Reason} — the reason names the cause (no_record, stale, engine_pin_changed, engine_reinstalled, model_pin_changed, needle_failed, parity_breach, host_mismatch, malformed_record).

2. Start, modes and idle release

Lane-bound starts go through the HTTP API (there is no zerg inference start; plain zerg start <model> sends only the model and is not lane-bound):

curl -X POST http://127.0.0.1:21434/api/v1/start \
  -H "Content-Type: application/json" \
  -d '{"model":"<model-slug>","lane":"<lane>","engine":"<engine>"}'

mode and duration_ms are optional body fields. The model slug is the running-lane slug from GET /api/v1/models (the manual three-node smoke resolves it from the same list); a start that finds the lane already serving answers 409 already_running.

Service modes (modes_allowed in the registry is the per-lane ceiling):

ModeBehavior
on_demandDefault. Idle release after 15 min (lane_idle_release_ms = 900000); per-lane opt-out is the registry row’s idle_release_ms (a lane carrying it is never auto-released).
durationBounded by the start body’s duration_ms (max lane_duration_max_ms = 86400000).
attendedNo automatic bound — it stays until stopped or the node needs the slot. Use deliberately; it holds the GPU.
cronScheduled via the lane_cron config map (lane id → schedule).

Stop a running lane by its model slug:

zerg stop <model-slug>
zerg stop-all

The governor reaps orphans (a pid that outlived the state machine) after lane_orphan_ttl_ms (1 h) and enforces the VRAM budget with lane_vram_headroom_mib (1229 MiB) reserved for image work.

3. Validate a lane (the serving gate)

Validation is the needle gate plus parity; it is derived at read time, and only origin=zerg rows can back it. Plan the matrix first (no GPU):

scripts/lane-certify.sh --plan --host <node-label>

Then run the real certification (loads each selected lane, probes the admin route, appends the measurement row, checks parity, commits only a complete run):

# Real mode is admin-authenticated. The token is read from a 0600 file (or
# ZERG_SOL_TOKEN); it never goes on the command line or into another
# process's argv.
install -m 0600 /dev/null /etc/sol/lane-certify.token
# printf '%s\n' '<admin-token>' > /etc/sol/lane-certify.token
scripts/lane-certify.sh --host <node-label> --lanes qwen38_atx \
 token-file /etc/sol/lane-certify.token

Single-lane needle runs against an already-running lane:

scripts/lane-needle.sh --lane qwen38_atx

The admin route can also be driven directly:

curl -X POST http://127.0.0.1:21434/api/v1/inference/lanes/qwen38_atx/validate

Re-validate after every engine bump or model re-pin: the validation record compares the engine ref/build, the installed manifest hash, the model pin and the TTL (lane_validation_ttl_ms, 30 days).

4. Failover expectations

lane_failover_enabled is on and lane_failover_require_validation is on: a validated lane can be served from another node in the cluster when the local node cannot (lease released on lane kill / node loss, inventory converges, the next resolve picks a validated peer). A lane whose validation is stale or breached is not a failover destination — it refuses and the refusal is counted (sol_lane_placement_refused_total{reason="lane_not_reachable"}, etc.). A worker holding a live grant learns of a lane stop/failover at the next task boundary (mid-turn revocation push is a recorded future wire revision, not a defect).

Manual cluster drill (operator-run, never in CI):

#: --lane-fetch asserts every running local lane's runtime
# port sits inside the PUBLISHED range (18001-18010; {base_port, 18001}
# lockstep, ) and fetches http://<node>.<cluster-domain>:<port>/health
# (the cluster's internal DNS suffix; override with --lane-domain).
# --lane-peer NODE runs the fetch FROM ANOTHER NODE over ssh — the
# cross-node/WILD- acceptance leg.
scripts/cluster-smoke.sh --lane-fetch --lane-peer green

Red lane-only-member decision. Red stays a LANE-ONLY cluster member: no Mango, no orchestrator lease, no validation/failover authority. It serves its GPU lanes on host networking; placement/failover decisions stay on the Mango-backed nodes. The published lane range (18001-18010) is audited free on all three nodes (18080 kube-router and the k0s NodePort range 31000-32767 excluded) and must stay in lockstep with {base_port, 18001} in server/config/sys*.config.

Circuit-key semantics

Circuit state is keyed by the resolved target, never by a model name:

a local lane owns exactly {local, Ref}. A failing local weight set whose name looks like a cloud family (gpt-oss-*, qwen3-coder, …) can no longer open a remote provider circuit and 503 unrelated traffic

a registry-registered provider (a declarative provider config name) owns {provider, Name}. Only a genuine provider outage opens it, and the two registry HTTP funnels consult it pre-dispatch (503 provider circuit open: <name>). A startup check (sol_provider_boot:register_defaults/0) verifies the bundled provider names against docs/fixtures/model_provider_map.json; a cluster peer endpoint (another node’s llama.cpp server) owns {Host, Port} — the resolver checks it before dispatch, as before.

So sol_circuit_breaker_state{name="{local,ref}"} / {name="{provider,\"openai\"}"} are the two families to read during an incident: a local lane outage shows on {local, …} only, and a provider outage shows on the matching {provider, …} aggregate (the provider-name vocabulary is pinned by ci/model_provider_parity_lint.py).

5. Weight provisioning

scripts/lane-model-sync.sh moves and verifies a lane’s weight set:

scripts/lane-model-sync.sh --lane qwen38_atx --files /path/to/model.gguf --dest /fun/models/Qwen3.8-27B-ATX --sha256 <sha256>

It verifies every copied file’s sha256 after transfer, refuses a mismatch (removing the bad copy), syncs to a remote host over ssh with a re-hash, and writes a lane-model-receipt.json next to the destination recording each file’s digest AND byte size. The start path re-stats against bytes, so a truncated/swapped GGUF is refused (primary_pin_unverified) without re-hashing. Pass --unhashed only when the registry pin is explicitly unhashed — it says so loudly. Production lanes additionally require the operator’s pin_ack in the lane row to run unhashed at all; every unhashed-ack start is counted (inference_lane_weights_unhashed_total{lane=...}) so the unhashed posture stays visible until the pins converge. A lane whose registry sha256 is set will fail validation with model_pin_changed until the bytes match.

6. Engine install, rollback and bump protocol

Installs are whole-tree units: <root>/<build>/{bin,lib} plus the <root>/current symlink. The binary alone is never the unit — stale shared libraries silently keep the old backend.

scripts/engine-install.sh llama-b11639-linux-x86_64.tar.gz --root /opt/llama \
 production \
 expect-build b11639 --expect-ref ggml-org/llama.cpp@a0e6dc7384edb8f5d927155e1d26c10b4a310e6d
scripts/engine-rollback.sh --root /opt/llama
scripts/engine-rollback.sh --root /opt/llama --to b11011

Install requires the .sha256 sidecar and validates every archive entry before extraction (absolute paths, .., symlinks, hardlinks, devices and FIFOs are refused; extraction uses --no-same-owner). --production requires a verified minisign signature (the default remains off for local fixture installs; a PRESENT but unverifiable signature is always refused). --expect-ref is an EXACT match. The whole install holds an exclusive flock on <root>/.engine-root.lock — concurrent installs serialize, and a killed install leaves at most a staging directory that the next install cleans. Replacing an existing build (including the same-build reinstall, the operation that invalidates ENG-7) renames the old tree aside instead of deleting it: a failure inside the swap restores it, and the next install’s lock-window recovery restores/cleans a leftover .old-<build>-*, so the previous known-good survives a kill at the seam. --expect-build/--expect-ref pin the install to the registry’s engine row: an arbitrary artifact can no longer be installed AS the registry’s build id.

A health canary probes the packaged server before the current flip. Rollback flips <root>/current; Sol serves the rolled unit when the registry-pinned build directory is gone (engine_pin_missing_fallback, loud log + counter) and keeps the pin whenever it still exists (, ). Fixture-class artifacts speak the FIXTURE_PORT=<n> protocol on port 0; every other class is probed like a real llama-server: a free port is allocated, the server is started with --port N --model <canary-model> and /health is polled. Pass --canary-model <smoke.gguf> for a real engine canary (the default model name only works for engines that tolerate a missing model, e.g. the CI mock); --no-canary stays loud. A failed canary leaves the old build active. : the documented install path never passes --no-canary — the canary passes now that the artifact rpath includes $ORIGIN and the CUDA runtime/libgomp travel in the artifact’s bin/ (a canary failure is a real packaging defect, not a reason to skip the proof). Rollback verifies the candidate’s own install receipt against a freshly computed tree hash — a tampered/corrupt candidate is refused before the flip — then re-probes it (same class-aware protocol, per the install receipt’s class field) and refuses loudly when there is no candidate.

Certification evidence contract: a production lane is validated only from ZERG-produced evidence. The commit route (POST /api/v1/inference/lanes/:lane/validate, mode commit) requires:

the row’s origin to be zerg (a foreign-origin row refuses typed origin_not_zerg); the claimed row_ref to exist in the configured artifact CSV (lane_benchmark_csv config; configured-but-unreadable is a fail-closed 503 artifact_csv_unreadable, an unknown row refuses 409 row_not_in_artifact); an engine install receipt (<root>/installed.json from engine-install.sh) with a real manifest_hash — no receipt refuses no_receipt, a receipt whose engine/build moved refuses engine_unvalidated/engine_reinstalled on the next read; parity evidence: pass, or single_host only with the explicit allow_single_host ack (the runner forwards it from lane-certify.sh --allow-single-host and records the ack in the transcript). A missing parity verdict refuses parity_required.

A receipt-less or unverified record never satisfies the runtime gate after the fact either: the evaluate path refuses no_receipt / unverified_manifest — an engine reinstalled by any other means (or a deleted receipt) invalidates the lane on the next read.

Bump protocol: build from the pinned source ref (recorded in engines/<class>.json; build.sh --ref verifies HEAD == ref on a clean tree and builds the committed tree — a dirty or mismatched checkout is refused, ), certify the new build with scripts/lane-certify.sh, install it on one host, run the needle rows again, then roll the rest of the fleet. Never flip a default before the measured row lands in the artifact. ci/engine_config_drift_lint.py reds any registry pin that drifts from the engines/*.json corpus (and vice versa). The uplift moves the llama.cpp production rows to b11639 (a0e6dc7384edb8f5d927155e1d26c10b4a310e6d) through this protocol; the registry now carries that ref and the engine lane owns the matching manifest/build distribution.

GSQ-RCO Coder — two engines, no default flip

The GSQ-RCO Coder pin (ISTA-DASLab/Qwen3.8-Flash-Next-GSQ-RCO-Coder-GGUF @ 5348543e0147355ac9cbcb031184a3546350988e) is registered twice:

qwen38_gsq_coder — the Strata 0.1.44.1 engine row (Niko1221/Strata@296b59d2f7), standardized 256k/batch4/MTP (the Sol lane declares slots_max 2 under the registry big-lane cap; the engine template carries batch4), kind => staged, production => false. The strata_sm86 runtime/install is the engine lane’s module, not the llama.cpp engine-install.sh path. qwen38_gsq_coder_llama — the llama.cpp b11639 fallback on the same shards (measured recipe --fit on --fit-target 256 --moe-cache-mib 4096, KV q4_0), kind => staged, production => false. The registry schema currently exposes fit/load_mode but not fit_target/moe_cache_mib; that argv surface is the engine lane’s follow-up, so the row records the recipe but does not yet render those two flags.

Both rows are validation-only: the ghost P7 rows are origin=ghost provenance, and the zerg-side needle/parity run is. The two open ghost gates (mmproj formal caption A/B; code/agentic tool-call JSON spot-check versus the full model) also remain open. Do not flip a default or promote either row from ghost evidence.

7. Requesting and switching lanes from Luna

Luna’s lane provider is grant-driven: the worker asks Sol (lane_control resolve | start | stop | switch), and Sol answers with the descriptor (lane, endpoint, wire format, caps, ctx, lease id, expiry). Operators normally do not need to act — an agent session requests a lane when it needs one. When a request is refused, Luna surfaces the typed reason; the corresponding registration/lease gates are in docs/zmq-protocol-reference.md and the lane control section of the security docs.

Fallback ownership with a Sol binding

A task carrying a Sol binding (the inference_binding lane grant, or a granted lane_control_ack) is Sol-managed inference: Sol owns fallback. Luna’s provider_failover recognizes a Sol-bound provider (lane_grant/keyless) and never model-switches — it keeps only its transport-level retries and falls through to the typed error; the server-side chain (fallback_chains in the declarative-provider config — see docs/provider-setup.md) is the single fallback plane. Without a binding (a direct-provider config: TUI/print against your own keys), the client-side fallback_providers/fallback_model chain is unchanged. No wire field changes: the binding already travels on the task frame.

Interactive editor sessions

An editor session is a session lease with refresh, not a per-turn resolve. The lane grant is still ACQUIRED by the first task Sol dispatches to the worker (the identity/ownership anchor is unchanged); while the session is active Luna refreshes the live lease through the existing lane_control frame:

actionfields (existing wire shape)semantics
resolve / starttask_id + lane/requirements + mode/ttl_msacquire (task-scoped, the only way to start a session)
refreshlease_id + holder + lanerenew under the lease’s own mode; the ack carries the receipt-relative expires_in_ms
releaselease_id + holder + lanedrop THIS worker’s hold and re-arm the lane’s idle clock; the lane is not stopped while other holders exist
switchlease_id + holder + target laneresolve the target under the grant-recorded owner, then drain the old lane

holder is the nonce minted with the grant; the owner is the store-derived identity captured at grant time — a frame-supplied user_uuid is never trusted. Expiry answers stale_grant (a TYPED re-request on the next turn); there is no silent fallback. Audit rows: lane_session_refresh, lane_session_release, lane_session_switch, lane_session_stop. The editor launches this posture with luna --connect tcp://<sol>:5555 --editor (the :ZergConnect command in example/vim); when no Sol is reachable the editor keeps the standalone stdio posture.

8. New machine-class onboarding

  1. Build the engine for the class (CPU/GPU, flags per the engine matrix) and add the engines/<class>.json manifest row (production, ref, build, cmake_flags, arch; the fixture engine carries production: false + exclude_reason and never promotes).
  2. Add the class to node_classes and its facts to lane_host_policy (VRAM/RAM budgets, session cap, allowed lanes, host env).
  3. Start the lane on the new host and run the needle gate; append the row with scripts/lane-certify.sh.
  4. Only then does the lane become placement-eligible on that class.

9. “No lane available”

Luna prints a typed failure instead of silently falling back:

lane_unavailable: <reason> (lane=<lane>) — no local lane available; start a
lane with POST /api/v1/start or POST /api/v1/prepare/:name; list lanes with
GET /api/v1/inference/lanes

Operator checklist: is the lane running (GET /api/v1/inference/lanes)? Is it validated (fresh needle row, not stale, parity within band)? Is the worker registered on the same node/lease? Is the host VRAM budget full (check the governor state and sol_lane_placement_refused_total)? A keyless remote provider is never a substitute — there is no fallback lane by design.

10. Operator event queries (the event spine)

The lane lifecycle, maintenance flips and restore verification are durable events in the sync-event store (lane.*, maintenance.*, restore.* — the spine). Query them through the events API with an admin token; the executable form of these three chains is exercised by server/test/sol_event_spine_runbook_SUITE.

TOKEN=<admin-token>
BASE=http://127.0.0.1:21434
LANE=qwen38_atx
NODE=sol@$(hostname)

# What happened to lane $LANE: every lane event, newest first.
# (types: lane.requested/granted/queued/failed/lease_* /cron_* /fallback/…)
curl -s -H "Authorization: Bearer $TOKEN" \
  "$BASE/api/v1/events?aggregate=$LANE&limit=100"

# Why did maintenance flip: the node's maintenance.enabled/disabled rows
# (aggregate = the Sol node name; data.reason carries the operator reason).
curl -s -H "Authorization: Bearer $TOKEN" \
  "$BASE/api/v1/events?aggregate=$NODE&limit=20"

# Was restore verified: restore.verified / restore.mismatch /
# restore.checksum_mismatch (aggregate = the fixed `restore` scope).
curl -s -H "Authorization: Bearer $TOKEN" \
  "$BASE/api/v1/events?aggregate=restore&limit=10"

A lane that never granted still has a trail: lane.failed carries the typed refusal (data.reason) on the requested lane aggregate, and pre-resolve failures land on the unknown aggregate. Cross-node stores are node-sharded (docs/event-store.md §Cluster scope) — query the node that granted the lane.

11. Standalone / air-gap editor hosts

A Sol-less host — an air-gapped laptop, a single editor box, a field machine — runs a ZERG-provenanced engine bundle, never an arbitrary daemon. The standalone posture is explicit (--standalone / ZERG_COMPLETE_STANDALONE=1), never implicit: a host with a reachable Sol uses the Sol-bound posture; a host without one declares standalone.

Ownership split (standing). wild owns CD: engine images, builds, bundle production and publishing (build-engines → supply-chain → push-staging → publish-release). zerg owns the bundle format, the consumer recipe (scripts/engine-bundle-consumer.sh), the install/rollback scripts and these docs.

11.1 The bundle

A engine bundle is the whole-tree distribution unit:

<artifact>.tar.gz                 # bin/ + lib/ (self-contained, $ORIGIN rpath)
<artifact>.tar.gz.sha256          # mandatory (fail-closed)
<artifact>.tar.gz.manifest.json   # build/class/host_class/manifest_hash
<artifact>.tar.gz.minisig         # optional signature (REQUIRED by the consumer)
bundle-receipt.json               # optional ZERG bundle receipt

The consumer verifies sha256 always, the manifest hash shape, an optional bundle-receipt.json (artifact/sha/build/manifest-hash equality), and the minisign signature. Unsigned bundles are refused unless --allow-unsigned is passed explicitly (fixture/local bundles only); a present-but-invalid signature is always a refusal. A missing .sha256 or a tampered artifact is a typed refusal before anything is unpacked.

11.2 Side-load (air-gap) and explicit fetch

Air-gap hosts side-load the bundle directory (USB/rsync/scp — the operator chooses the transport; the consumer never fetches in standalone mode):

scripts/engine-bundle-consumer.sh verify  --bundle-dir /media/zerg/bundle
scripts/engine-bundle-consumer.sh install --bundle-dir /media/zerg/bundle \
 root "$HOME/.local/share/zerg/engines"

A networked mirror host may explicitly fetch (the fetch is the operator’s egress action; the editor path never fetches):

scripts/engine-bundle-consumer.sh fetch --url https://mirror.example/zerg/engines \
 artifact llama-b11639-linux-x86_64.tar.gz \
 dest /srv/zerg/bundles --with-signature --with-receipt

Fetch accepts https or EXACT loopback http (localhost, 127.0.0.1, [::1] only — 127.attacker.example is not loopback); a non-loopback plaintext mirror needs the explicit --allow-insecure-http ack. Every downloaded bundle is verified before the command reports success.

11.3 Host class and install location

The manifest carries host_class / min_microarch / required_cpu_flags; engine-install.sh refuses a wrong-target artifact with the typed incompatible_host_class reason (for example a cpu_epyc/znver4/AVX-512 build on a Zen-1 host, the class — never install-and-hope). --host-class cpu_zen1 additionally pins the install to that class; a bundle labelled otherwise refuses host_class_mismatch.

The default root is ${XDG_DATA_HOME:-$HOME/.local/share}/zerg/engines (override --root or ZERG_ENGINE_ROOT). System roots (/, /usr, /etc, …) are refused unless ZERG_ENGINE_ALLOW_SYSTEM_ROOT=1 in a disposable container. Installs are serialized by engine-install.sh’s flock, keep the previous build for rollback, and write both the engine receipt (<root>/installed.json) and the consumer receipt (<root>/bundle-consumer.json).

11.4 Upgrade, status and rollback

scripts/engine-bundle-consumer.sh upgrade --bundle-dir /media/zerg/bundle-v2 \
 root "$HOME/.local/share/zerg/engines"
scripts/engine-bundle-consumer.sh status  --root "$HOME/.local/share/zerg/engines"
scripts/engine-bundle-consumer.sh rollback --root "$HOME/.local/share/zerg/engines"

upgrade requires an existing current and uses the same verification as install. rollback delegates to engine-rollback.sh: the candidate’s receipt is compared against a freshly computed tree hash and the candidate is health-probed before the current flip; no candidate is a loud refusal.

11.5 Run the engine (no Sol, no lane registry)

The installed unit is <root>/current/{bin,lib}. Start the packaged server directly on loopback with the model row’s measured flags:

"$HOME/.local/share/zerg/engines/current/bin/llama-server" \
 host 127.0.0.1 --port 18001 \
 model /fun/models/qwen38-gsq-rco/Qwen3.8-Flash-Next-GSQ-RCO-Coder-IQ1_M.gguf
curl -fsS http://127.0.0.1:18001/health

No Sol, no lane registry, no orchestrator: the engine is a bundle + this recipe. A strata-class bundle runs its packaged wrapper instead (bin/strata-server --config lib/strata/config/...); it has no FIM surface today.

11.6 Settings providers (chat + standalone completion)

Declare the local engine once in the layered settings; chat routes to it through the normal provider stack (keyless-loopback rule: explicit no_api_key = true, loopback only), and standalone completion uses the same record:

{
  "model": "local-chat",
  "providers": {
    "local": {
      "base_url": "http://127.0.0.1:18001",
      "wire_format": "openai",
      "models": ["local-chat"],
      "no_api_key": true
    }
  },
  "standalone": {
    "provider": "local",
    "model": "local-chat"
  }
}

The keyless rule is fail-closed: no_api_key with a non-loopback base_url is refused at config load; a keyed provider cannot be used for standalone completion. Completion is explicit:

printf '{"prefix":"def add(a, b):\n    ","suffix":""}' \
    | client/run --complete --standalone

The local engine’s /infill carries the same window/token/stop/trim semantics as the Sol-bound POST /v1/completions path (prefix tail 8000 B, suffix head 1000 B, 96-token default budget, earliest-stop cut, suffix-overlap removal, CRLF→LF, trailing-whitespace trim). The loopback authority is DNS-pinned and the transport bypasses any proxy environment (CURLOPT_RESOLVE + NOPROXY="*"), so a proxy variable cannot route the call off-host. A down or misconfigured engine is a typed local_engine_* error — there is no Sol/cloud fallback in the standalone posture.

Air-gap acceptance transcript (fixture bundle + mock engine): plan/standalone-airgap-acceptance.md.

12. Revision 2 scope

Embeddings, reranking and LoRA serving are out of scope for this revision. The extension hooks are the lane kind, the registry schema, and the grant’s wire_format + caps; nothing in the current contract blocks them, but no operator should expect them from this release.