ZY-S1 GGUF + zy-engine
4-bit GGUF files of zyr-AGENT/ZY-S1 (ZY-S1 Preview, 1.18B, HRM-Text architecture, fine-tuned from Sapient AI's HRM-Text-1B), plus zy-engine (v0.2.0), a small CPU-first engine that runs it correctly as a PrefixLM.
| File | Quant | Size | SHA-256 | Notes |
|---|---|---|---|---|
ZY-S1-Q4_K_M.gguf |
Q4_K_M (4.97 bits/weight) | 737,476,672 bytes (701 MiB) | 4243f5d65362bd0e4ffd3a2c4cc39045eaedd6cd4443cf4c888f7b36c667c905 |
Default. Recommended. |
ZY-S1-Q4_0.gguf |
Q4_0 | 693,682,240 bytes (662 MiB) | 6cdcbfc28c663b56e069937cd21591e9d607399b06af4f7709354e3a1dda55e3 |
Faster, lower quality (see below) |
About Q4_0: it runs much faster on CPU (about 27 tok/s raw generation in llama-bench vs 12–15 for Q4_K_M
on our 8-vCPU Xeon VM), because llama.cpp repacks Q4_0 weights into faster kernels. But it is noticeably less
accurate: on 5 simple coding prompts compared against the full-precision model with greedy decoding, Q4_0
changed 2 of 5 answers (for example it dropped return in if n % 2 == 0: return True), while Q4_K_M
matched all 5. Use Q4_K_M unless speed matters more than accuracy.
ZY-S1 is a preview checkpoint. See the base model card for training details, evaluation and limitations.
⚠️ Why stock llama.cpp / Ollama / LM Studio give worse output
ZY-S1 is a PrefixLM: the prompt is read with full bidirectional attention, and only the response is
generated causally. llama.cpp supports the hrm_text architecture, but runs it with causal attention only,
so the prompt is read the wrong way and output quality suffers (e.g. JavaScript-style braces and repetition
loops instead of Python). Any app built on stock llama.cpp (llama-cli, llama-server, Ollama, LM Studio) has
the same limitation today.
zy-engine fixes this: it prefills the prompt in one non-causal batch, then decodes causally from the KV cache. On our test prompts its greedy output with Q4_K_M matches the Transformers PrefixLM reference exactly.
| Prompt (greedy) | Transformers PrefixLM | zy-engine (Q4_K_M) | stock llama.cpp (causal) |
|---|---|---|---|
add(a, b) |
def add(a, b):\n return a + b |
identical | — |
fibonacci(n) |
return fibonacci(n - 1) + fibonacci(n - 2) |
identical | — |
is_palindrome(s) |
def is_palindrome(s):\n return s == ... |
same start | def is_palindrome(s) {\n return s.is_palindrome(s).to_case(s).to_back(s)... |
Prompt format
### Instruction:
Programming language: Python
Task:
Write a function add(a, b) that returns the sum of two numbers.
### Response:
zy-engine applies this automatically (--lang none drops the "Programming language" line, --raw sends text verbatim).
Generation stops at EOS or at the next ### Instruction.
Quick start (zy-engine)
git clone https://huggingface.co/zyr-AGENT/ZY-S1-GGUF && cd ZY-S1-GGUF/zy-engine
cmake -S . -B build && cmake --build build -j --target zy-engine # fetches llama.cpp @ e467e5b
./build/zy-engine -m ../ZY-S1-Q4_K_M.gguf -p "Write a function add(a, b) that returns the sum of two numbers."
./build/zy-engine -m ../ZY-S1-Q4_K_M.gguf -i # interactive chat
./build/zy-engine -m ../ZY-S1-Q4_K_M.gguf --server --port 8080 # OpenAI-compatible API
./build/zy-engine -m ../ZY-S1-Q4_0.gguf -p "..." # faster, lower quality
Needs CMake ≥ 3.18 and a C++17 compiler; no GPU. -DZY_PORTABLE=ON builds a redistributable binary with
runtime CPU-feature dispatch.
Python package
A Python package is included in zy-engine/ (it is not on PyPI yet). It builds the engine and adds a zy
command that downloads the GGUF from this repo automatically (Q4_K_M by default):
pip install ./zy-engine
zy run -p "Write a function add(a, b) that returns the sum of two numbers."
zy run --quant Q4_0 -p "Write a function is_even(n) that returns True if n is even." # pick Q4_0
zy chat
zy serve --port 8080
Options
| Option | Meaning |
|---|---|
-n |
max new tokens |
--temp / --top-p / --top-k / --repeat-penalty / --seed |
sampling (--temp 0 = greedy, the default) |
-t / -tb |
threads for generation / prompt (default: physical cores) |
-c |
context size (default 2048, max 4096) |
-fa on|off|auto |
flash attention (default on) |
-ctk / -ctv q8_0 |
KV cache type |
--spec-draft K |
prompt-lookup speculative decoding: up to K draft tokens (default 8, greedy only) |
--spec-ngram N |
longest n-gram used to find drafts (default 3; --spec-ngram-min, default 2) |
--no-spec |
turn speculative decoding off |
--pin |
pin threads to cores (Linux). Opt-in: helps only on an otherwise idle CPU, and two pinned engines on the same cores slow each other down |
--no-kv-reuse |
chat: re-read the whole history every turn (exact PrefixLM, slower). By default only the new turn is prefilled |
--mlock, --no-mmap |
memory options |
Server endpoints: POST /v1/chat/completions, POST /v1/completions (both support "stream": true),
GET /v1/models, GET /health.
Speculative decoding (new in v0.2.0) guesses upcoming tokens by matching recent token sequences against the prompt and the text generated so far, then checks the guesses in one batch. With greedy decoding the model still picks every token, so the guesses only change speed, not which tokens are chosen.
CPU speed
8-vCPU Intel Xeon cloud VM, 8 threads, Q4_K_M, 49-token prompt, 64 generated tokens, median of 5 runs (zy-engine v0.1):
| Engine | Prompt (tok/s) | Generation (tok/s) |
|---|---|---|
| zy-engine (PrefixLM, flash-attn on) | ~110 | ~15.9 |
stock llama.cpp llama-completion (causal, degraded output) |
~108 | ~15.6 |
zy-engine v0.2.0: speculative decoding made generation about 25% faster than v0.1 across 10 short coding prompts, measured back-to-back under the same conditions (the machine was busy with other work at the time, so we only report the relative gain). Gains are larger on repetitive output and smaller on very short answers. Q4_0 reaches about 27 tok/s raw generation in llama-bench on the same VM (see the quality note above).
Memory: about 1.3 GB RAM at the default 2048 context. HRM-Text runs its two 16-layer stacks several times per token (128 layer passes), so generation speed is mostly limited by memory bandwidth.
Note on repeatability: on a busy machine, greedy output from llama.cpp's CPU backend (stock llama.cpp as well as zy-engine) can occasionally differ from run to run on prompts where the model is unsure between two tokens. On a quiet machine and on clear-cut prompts the output is stable.
Converting from the HF weights yourself
llama.cpp's convert_hf_to_gguf.py rejects the ZY-S1 / HRM-Text-1B tokenizer (Qwen2 regex + ByteLevel BPE)
as unknown. Apply zy-engine/patches/llama.cpp-hrm-text-tokenizer.patch to llama.cpp, then:
python convert_hf_to_gguf.py /path/to/ZY-S1 --outtype f16 --outfile ZY-S1-F16.gguf
./build/bin/llama-quantize ZY-S1-F16.gguf ZY-S1-Q4_K_M.gguf Q4_K_M
./build/bin/llama-quantize ZY-S1-F16.gguf ZY-S1-Q4_0.gguf Q4_0
Limitations
Preview model: it can produce incorrect code, especially on anything beyond simple functions. Q4_K_M loses a little quality compared with F16 on some prompts; Q4_0 loses more. Always test generated code.
License
Apache-2.0, same as ZY-S1 and HRM-Text-1B (see LICENSE, NOTICE.md).