Qwegn
From-scratch Apple Silicon LLM, VLM & System-1 engine in Swift 6.2 & Metal 4
Zero external C/Python runtimes · Apple10 NAX kernels · 0 steady-state allocations · 1M context
Qwegn (qwg + Qwegn.app) is a native Apple Silicon inference engine and quantization toolkit built from scratch in Swift 6.2 and Metal 4 — no MLX, no llama.cpp, and no PyTorch at inference time. Run local chat, OpenAI/Anthropic/Ollama-compatible APIs, 1M-token codebase memory, and < 15 ms System-1 MCP tools for coding agents directly on Apple unified memory.
Runs on Apple Silicon Macs (M1–M5+; macOS 26.2+ and M5 recommended for Metal 4 NAX cooperative tensors; Xcode 26.2+ and Python 3.13 are needed only when building from source or quantizing).
Table of Contents
Latest Release — v0.48.1: Hardens Apple Silicon M1–M5+ reliability with automatic poisoned MTLCommandQueue recovery and QW_CMD_BUFFER_DIAG=1 encoder fault diagnostics across all runtimes (QWHyperStreamRuntime, QWEngineDriver, QWInkling2Runtime) and speculative drafters (DFlash/DSpine, ECHO, DSpark, QWMTPDraftChain), 128 GiB HyperStream prefill scratch eviction and checked 256-thread PLE/HC/QSA dispatches, deferred streaming HTTP 200 headers with atomic pre-start cancellation (cancelPreStartIfUnstarted), HTTP 500/400 JSON errors for prefill failures, named mid-stream event: error frames, supported-model server auto-discovery filtering, restored HyperStream ple: true layer-kind validation, unified Block_AQ8_G32 hybrid HQ8_G32 loading, and macOS 26.2 NAX OS-floor gating — building on v0.48.0's Day-0 Qwen4 Dense/Qwen4-MoE support (Qwen4-35B-A3B-QWP_4: 5,067.6 tok/s prefill, 195.1 tok/s server decode / 304.3 tok/s predictable MTP, 291/291 100% llmprobe conformance). See CHANGELOG.md.
Quick Start
1. Install Qwegn
Download the signed Qwegn-<version>-macos-arm64.pkg from GitHub Releases (installs /usr/local/bin/qwg and /Applications/Qwegn.app), or build from source:
git clone https://github.com/qwegnai/qwegn.git && cd qwegn
make init # verify toolchain, set up quantizer venv, generate test goldens
make build # build release .build/release/qwg and Qwegn.app
2. Pull and Run Your First Model
Browse pre-quantized packs on huggingface.co/qwegnai, pull one, and run a prompt or interactive chat:
qwg pull qwegnai/GigaChat4-37B-A4B-QWP_4
qwg run GigaChat4-37B-A4B-QWP_4 --prompt "Explain unified memory in three bullet points." --max-tokens 160
qwg repl GigaChat4-37B-A4B-QWP_4 # interactive terminal chat (or open /Applications/Qwegn.app)
3. Start the Local Server and Query It
qwg serve GigaChat4-37B-A4B-QWP_4 --context-tokens 131072 --kv-mode q4 --mtp-backend dflash2 --mtp-drafts 5
Send an OpenAI-compatible request or open http://127.0.0.1:8080/ui in your browser for the built-in offline workbench:
curl -s http://127.0.0.1:8080/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{"model":"GigaChat4-37B-A4B-QWP_4","messages":[{"role":"user","content":"Hello!"}],"max_tokens":128}'
Why Qwegn?