forgo.cloud
Sign in
Repo workspace

forkjoin-ai/gnosis

Qwen2.5-0.5B Cheap Knot — CI-Fast Quality Gate

distributed-inference/docs/qwen-0.5b-cheap-knot.md
forkjoin-ai/gnosis

Qwen2.5-0.5B Cheap Knot — CI-Fast Quality Gate

Date: 2026-05-22

Why

The quality gate currently runs against the coder-7B dense knot (~/.edgework/models/qwen-coder-7b.knot, ~4.7 GB). That model is large and slow, which makes the gate expensive to run in CI. Qwen2.5-0.5B-Instruct is ~400 MB and runs in a fraction of the time. This document records producing a dense KNOT from the 0.5B GGUF and verifying it answers the PARIS baseline, so the gate can use it instead.

Note: this is about acquiring open model WEIGHTS and converting them into our own KNOT format for our own fat-station / paris-probe runtime. It is not a third-party inference engine.

Artifacts produced

Artifact Path Size
Source GGUF ~/.edgework/models/Qwen2.5-0.5B-Instruct-Q4_K_M.gguf 397,808,192 B (~397 MB)
Dense KNOT ~/.edgework/models/qwen2.5-0.5b-instruct.knot 391,882,333 B (~392 MB)

Both magic-checked: GGUF starts with 47 47 55 46 ("GGUF"), KNOT starts with 4b 4e 4f 54 ("KNOT").

Model config read from GGUF: arch=qwen2, hidden_dim=896, layers=24, heads=14, kv_heads=2, head_dim=64, ffn=4864, vocab=151936, rope_theta=1000000, rms_norm_eps≈1e-6. 290 tensors, all Q4_K/Q6_K/F32 (0 skipped).

Steps (reproducible)

  1. Download (public, no auth):

    curl -L -o ~/.edgework/models/Qwen2.5-0.5B-Instruct-Q4_K_M.gguf \
      https://huggingface.co/bartowski/Qwen2.5-0.5B-Instruct-GGUF/resolve/main/Qwen2.5-0.5B-Instruct-Q4_K_M.gguf
  2. Convert to a dense KNOT (verbatim quantized-byte repack, no re-quantize):

    cd open-source/gnosis/distributed-inference
    python3 gguf-to-knot.py \
      ~/.edgework/models/Qwen2.5-0.5B-Instruct-Q4_K_M.gguf \
      ~/.edgework/models/qwen2.5-0.5b-instruct.knot \
      --name qwen2.5-0.5b-instruct

    The converter's own reverse round-trip check (first/middle/last tensor) all reported match=True and the tool printed OK.

  3. Probe the PARIS baseline:

    ./target/release/paris-probe-rknot \
      --dense ~/.edgework/models/qwen2.5-0.5b-instruct.knot \
      --dense-only \
      --tokens 785,6722,315,9625,374 \
      --expected 12095 \
      --top-k 8

Probe result — PARIS baseline

Prompt tokens [785, 6722, 315, 9625, 374] decode (via the GGUF vocab, loadQwenTokenizerFromGguf(...).decode([...])) to exactly:

"The capital of France is"

The 0.5B argmax is token 12095, which decodes to " Paris" — the same answer the coder-7B gives. The probe exits 0 (PASS).

Top-8 logits, with decoded text:

rank token_id logit decoded
0 12095 +14.343351 " Paris"
1 279 +13.880878 " the"
2 9625 +13.008535 " France"
3 264 +12.529582 " a"
4 13 +12.151167 "."
5 6722 +11.851743 " capital"
6 624 +11.776693 ".\n"
7 7407 +11.618499 " located"

Logit health: all 151936 logits finite, 0 NaN/Inf/zero. Max finite logit +14.34 at token 12095, min -15.29, mean |finite| +3.78. No residual NaN/Inf at any of the 24 layers.

Timings (wall clock, time -p real)

Step Run Time
Download (~397 MB) cold 11.63 s
GGUF→KNOT convert (single run) 10.28 s (internal write 9.58 s)
Paris probe cold (1st) 1.81 s
Paris probe warm (re-run #1) 3.53 s
Paris probe warm (re-run #2) 3.68 s
Paris probe warm (re-run #3) 9.56 s
Paris probe warm (re-run #4) 11.82 s

Notes on timing:

  • The KNOT loads in 0.00 s reported by the probe (mmap), so probe wall time is forward pass + lm_head, not load. The lm_head over the 151936-vocab takes ~0.20 s; per-layer forward is ~0.03–0.19 s.
  • Warm timings on this machine were noisy (3.5 s up to 11.8 s) due to host CPU contention during measurement, not because of cold/warm cache behavior — the cold run was actually the fastest observed (1.81 s). The honest read is: a single Paris probe on the 0.5B knot is a low-single-digits-to-low-tens-of- seconds operation, dominated by the dense forward pass, with no large fixed cost. This is dramatically cheaper than running the same gate against the 4.7 GB coder-7B.

Recommendation — make the gate CI-cheap

The 0.5B passes PARIS and gives the identical " Paris" argmax as coder-7B, so it is a valid drop-in for the cheap gate. Configure:

MONSTER_SWARM_QWEN_KNOT=~/.edgework/models/qwen2.5-0.5b-instruct.knot

with expected token id 12095 (" Paris") on prompt tokens 785,6722,315,9625,374 ("The capital of France is").

Exact gate invocation (exit 0 == pass):

paris-probe-rknot \
  --dense $MONSTER_SWARM_QWEN_KNOT \
  --dense-only \
  --tokens 785,6722,315,9625,374 \
  --expected 12095 \
  --top-k 8

To reproduce the knot from scratch in CI, run the download + convert steps above; both together complete in well under a minute and need ~800 MB of disk (GGUF + KNOT) under ~/.edgework/models/.