Repository navigation
QERLIO v0.3.0 — Native GGUF Inference Engine
Correction Notice (Added with Release v0.3.1):
- The
v0.3.0release was merged, tagged, and published prior to management review.- See Release v0.3.1 for the corrected and cleaned release.
- Corrections to
v0.3.0notes:
- The registry count is corrected from
5 testedto1 tested(seed_36b) /183 experimental(184total):qwen35(prior 4-token run used an unofficial UD quant) and ZAQERIS catalog entries (zaqeris_axiom,zqn_12b,zaqeris_7b, lacking official>= 64-token runs) do not meet thetestedcriteria.- Pytest suites
tests/test_t4_to_t10_engine.pyandtests/test_qwen35_engine.pyexecute deterministic synthetic toy fixtures, not real multi-billion-parameter weights.v0.3.0lacked rootLICENSE,pyproject.toml, andCODE_OF_CONDUCT.mdand had uncleaned/v1/modelsstubs and broken relative doc links; resolved inv0.3.1.
QERLIO v0.3.0 — From-Scratch Native GGUF Inference Engine (seed_oss + qwen35)
What's New
- From-Scratch GGUF v2/v3 Loader (
core/inference/gguf_loader.py): Binary GGUF header/metadata/tensor parser, alignment handling, memory-mapped tensor access, row-level dequantized lookup (get_tensor_rows_f32), and corrupt/truncated file rejection. - 16 GGML Dequantization Kernels (
core/inference/dequant.py): Native decoders forF32,F16,BF16,Q4_0,Q4_1,Q5_0,Q5_1,Q8_0,Q2_K,Q3_K,Q4_K,Q5_K,Q6_K,IQ4_NL,IQ3_S, andIQ4_XSverified within< 1e-6absolute error. - Native Byte-Level BPE Tokenizer (
core/inference/tokenizer.py): Reads vocabulary, merges, and special/control tokens directly from GGUF metadata with NFC normalization,seed-coder/qwen35/gpt2pre-tokenization, and exact encode/decode round-trip. SeedOssForCausalLM&Qwen35ForCausalLMNative Engines (core/inference/seed_oss_model.py,core/inference/qwen35_model.py): From-scratch execution for Hermes 4.3 36B (seed_oss: RMSNorm, half-split RoPE, GQA with QKV biases,post_attention_norm, SwiGLU MLP, dynamic GGUF config) and hybrid Qwen3.5/Qwen3.8 (qwen35: Gated DeltaNet + Gated Full-Attention +Qwen35HybridCache), with KV cache, sampling, stop sequences, and cancellation.- From-Scratch C11 SIMD Quantized GEMM & Streaming (
include/qerlio/native_gemm.h,core/inference/native_gemm.c,core/inference/native_gemm.py): AVX2+FMA+F16C kernels with portable scalar fallback forQ4_K,Q6_K,Q8_0, andF32, double-buffered sequential streaming (SequentialTensorStreamer), and batchedSeedOssEngine.forward_batch(). - Live Local API Gateway & CLI (
server/local_api/server.py,tools/qerlio_cli.py):/v1/models/load,/v1/models/unload,/v1/chat/completions,/v1/messages, andqerlio hermes chat --model-pathrunning the native engine with"simulated": falsewhen a GGUF model is loaded.
Verified Results (NousResearch/Hermes-4.3-36B-GGUF)
Verified on the official models/hermes-4_3_36b-Q4_K_M.gguf checkpoint (21,762,145,216 bytes, SHA-256 17823599694fa3503ef54bf748d5078c6ce881f4d01616cafa255dc05d215a08):
- T1–T3 (Loader / Dequant / Tokenizer): 27 KVs and 771 tensors matched
tests/fixtures/hermes_4_3_36b_q4_k_m_metadata.json; 21gguf-py 0.19.0dequant cases matched (max_abs_err=0.00e+00); 64/64 tokenizer cases matchedtokenizers 0.23.3with exact round-trip. - T4 & T5 (Logits & 64-Token Greedy vs
transformers 5.20.1): Batched prefill in47.87s; top-1 matched on 5/5 prompts, top-5 overlap 5/5, max top-20 logit diff2.10e-05, and320/320greedy tokens matched identically (2362.87s). Single-pass C GEMM latency on'The capital of France is':50.75s(vs419.43sNumPy-only path). - T6 (KV Cache Parity): Cached vs uncached recomputation matched with
max_abs_diff=7.58e-05and identical top-1 token (1371). - T7–T9 (Chat, Thinking, Tools & Robustness): Two-turn chat (
'The capital of France is Paris.','The Seine River flows through Paris.'),thinking=Trueclosed</think>with answer4andkeep_cotsverification, model-generated<tool_call>mapped to OpenAItool_callsand Anthropictool_use, plus context-overflow, KV budget, stop-sequence, and cancellation guards (active_sessions=0). - T10 & Automated Suite: All
184pytest tests pass (0failed,0skipped), and C++20 builds (ubuntu,windows,macos) +AddressSanitizer/UndefinedBehaviorSanitizer(includingcore/inference/native_gemm.candtests/cpp_safety_test.cpp) pass in GitHub Actions CI.
Runtime Dependencies
core/inference/: Python standard library + NumPy + optional from-scratch C11 shared library (native_gemm.c, C standard library only). Zerotorch,transformers,tokenizers,gguf,llama_cpp,vllm,sglang,onnxruntime, orpsutilruntime dependencies insidecore/inference/.- Offline reference generators live strictly under
tests/reference/.
Known Limitations
- CPU execution only; CUDA/Metal/Vulkan GPU acceleration is not implemented.
qwen35still runs on the NumPy path (610.40srecorded onQwen3.8-27B-UD-Q4_K_M.gguf); vision encoders and MoE architectures are not implemented.- 36B CPU inference latency is non-interactive (
2362.87sfor the 320-token batched run; hours for the full thinking run); peak memory was not measured. - The
thinking=Truegreedy verification output was completed in two deterministic segments from an exact saved 160-token prefix.
Reproduce
python -m pytest
python tools/qerlio_cli.py hermes download --quant Q4_K_M --output-dir models
python scripts/verify_hermes_36b_real.py --model-path models/hermes-4_3_36b-Q4_K_M.gguf --reference-fixture tests/fixtures/hermes_4_3_36b_transformers_reference.json