Skip to content
gpustackPublic

About

Ultra-fast, single-binary local LLM & VLM inference engine built natively for Apple Silicon.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Genie

License Platform Documentation

Genie logo

Genie is an ultra-fast local LLM inference engine built specifically for Apple Silicon. It ships as a single self-contained binary with compiled Metal kernel libraries embedded directly inside—no external shared libraries and zero configuration required to start serving local models and coding agents.

Read the Serving Guide, Benchmarking Guide, and Documentation Index for full details.

Architecture

Genie Architecture Overview

  • Clients & Agents: OpenAI Chat/Responses, Anthropic Messages (Claude Code / Codex CLI), and local CLI streaming text and vision from a single binary.
  • Genie Runtime: Iteration-level continuous batching (1..=8), Longest Prefix Match (LPM) scheduling, multi-lane DFlash2 / DFly2 speculative decoding, UMA-aware NVMe MoE & Engram streaming, native Metal vision towers, and a zero-copy radix prefix cache spanning UMA and NVMe SSD.
  • Apple AI Suite & MLX Weights: Built on Metal (GPU) with chip-routed M1–M5 kernels and optional Core ML (ANE) prefill on Apple9, directly loading MLX-compatible (Q4 / Q5 / Q6 / Q8 / BF16) weights.
  • Apple Silicon Base: Runs natively across MacBook Pro, Mac mini, Mac Studio, and Mac Pro on Unified Memory (UMA) and local NVMe SSD.

Highlights

  • Zero-config agent serving: genie serve --model <dir> or --model-hf <repo> automatically sizes --context from unified memory headroom, enables UMA-aware NVMe expert streaming when sparse-MoE weights exceed working-set memory, activates the zero-copy radix prefix cache, continuous batching (--concurrency 1..=8), GPU residency keepalive, and <model>/speculator/ or <model>/dfly/ auto-discovery.
  • Native Apple Silicon Metal & ANE execution: Ships a single binary with hardware-routed kernels across M1–M5 — Metal 4 TensorOps (BF16 and optional W4A8 int8), software-pipelined half-MMA prefill, absorbed MLA & DSA sparse attention, grouped sparse-MoE GEMV/GEMM, native multimodal vision towers, and startup-frozen Apple9 Neural Engine prefill.
  • Multi-lane DFlash2 & DFly2 speculative decoding: Directly loads shared BF16/FP8 DFlash2 drafters and bundled DFly2 drafters, self-probing each chip's Roofline ratio to scale speculative verification automatically with lossless greedy parity.
  • Broad checkpoint compatibility: Directly serves mlx-community affine group-64 checkpoints (Q4/Q5/Q6/Q8/BF16), Genie dynamic checkpoints (tools/convert), and uzu Block-32 Hadamard checkpoints.
  • Built-in GPU verification: Explicit, wildcard-free dispatch matrices (crates/metal/src/nn/linear_dispatch.rs) verified on local Apple Silicon via make verify against CPU references and negative controls.

Supported Models

Genie supports the following official upstream model architectures and checkpoints on Hugging Face:

Model Upstream Weights (Hugging Face) Architecture (model_type) Modalities Continuous Batching & Prefix Cache Speculative Decoding
Inkling-2-Mini thinkingmachines/Inkling-2-Mini Looped Sparse MoE + SWA/ShortConv (inkling2_loop) Text + Vision Yes DFlash2
Hy4-Flash tencent/Hy4-flash Sparse LatentMoE (512E top-16) + MLA/DSA/SWA + iHC/Engram (hy_v4_flash) Text + Vision Yes DFly2 (bundled)
Qwen3.8-27B Qwen/Qwen3.8-27B Dense Hybrid GDN + Full Attn (qwen3_5) Text + Vision Yes DFlash2

Ready-to-run checkpoints are available in the gpustack/genie Hugging Face collection. Other MLX-compatible affine group-64 checkpoints (Q4G64, Q5G64, Q6G64, Q8G64, mixed BF16) and uzu Block-32 Hadamard checkpoints of these architectures are also supported.

Benchmarks

Inkling-2-Mini (4-bit Looped MoE) — Apple M5 Max & M2 Ultra

Inkling-2-Mini (4-bit Looped MoE) Dual-Chip Benchmark

Qwen3.8-27B (4-bit) — Apple M5 Max & M2 Ultra

Qwen3.8-27B (4-bit) Dual-Chip Benchmark

See docs/bench.md for full tables, the Engine Factory Defaults & Alignment Matrix, and the Comparison Labeling Convention.

Quick Start

Install via npm

Requires macOS on Apple Silicon (arm64, macOS 11+) and Node.js 18+:

npm install -g --ignore-scripts @gpustack/genie
# or: pnpm add -g --ignore-scripts @gpustack/genie
# or run directly without installing:
npx @gpustack/genie --version

Run as a Background Service (macOS LaunchAgent)

genie start accepts the exact same options as genie serve, installs a per-user macOS LaunchAgent (ai.gpustack.genie) with auto-start on login, and routes logs to macOS Apple Unified Logging (subsystem == "ai.gpustack.genie") as well as ~/Library/Logs/genie/:

# Start in the background (auto-starts on login):
genie start --model-hf gpustack/Qwen3.8-27B-Coder390-MLX-5bit-dynamic
# or with a local model directory:
genie start --model /path/to/qwen3.8-27b-4bit

# Inspect the running launchd service (status, PID, endpoint, and log path):
genie ps

# View recent background logs or stream them live (Apple Unified Logging):
genie logs
genie logs -f
# Fallback log files are also mirrored to ~/Library/Logs/genie/genie.{out,err}.log

# Stop and unload the launchd service (no-op if nothing is running):
genie stop

Serve in the Foreground

Point genie serve at a local directory or directly at a Hugging Face Hub repository (--model-hf downloads via hf-hub / Xet into the standard ~/.cache/huggingface/hub cache):

genie serve --model /path/to/qwen3.8-27b-4bit
# or download directly from Hugging Face Hub (supports optional /subdir and @revision):
genie serve --model-hf gpustack/Qwen3.8-27B-Coder390-MLX-5bit-dynamic
# optionally pair with a separate Hugging Face DFlash2 drafter:
genie serve --model-hf owner/model --speculative-hf owner/drafter

Genie binds 0.0.0.0:8000 by default, automatically computes a 1024-aligned --context from available unified memory, enables the hot radix prefix cache, serves up to 8 concurrent requests, and loads /path/to/qwen3.8-27b-4bit/speculator/ if present.

Configuration Options

Run genie --help to view all CLI flags (shared by genie serve and genie start), their 1:1 GENIE_<OPTION> environment variable equivalents (for example --port → GENIE_PORT, --kv-format → GENIE_KV_FORMAT), and runtime GENIE_* / HF_* variables:

genie --help

Example: Tuned Coding-Agent Setup (64 GiB Mac)

For long-context coding agents running a dense 27B checkpoint (such as Qwen3.8-27B-Coder390) alongside desktop apps on a 64 GiB Mac:

genie start \
  --model-hf gpustack/Qwen3.8-27B-Coder390-MLX-4bit-dynamic \
  --kv-format int8 \
  --context 98304 \
  --concurrency 2 \
  --temperature 0.6 \
  --top-p 0.95 \
  --top-k 20 \
  --prefix-cache-ttl-ms 1800000
  • --kv-format int8: halves full-attention KV memory and long-prompt read bandwidth, preventing macOS memory-pressure evictions of the prefix cache.
  • --context 98304: bounds per-request context cleanly (use 65536 if you want extra desktop headroom).
  • --concurrency 2: trims unused Gated DeltaNet state reservations from the default 8 slots for single-user agent sessions.
  • --temperature 0.6 --top-p 0.95 --top-k 20: overrides temperature: 1.0 checkpoint defaults to improve code stability and DFlash2 speculative acceptance rate.
  • --prefix-cache-ttl-ms 1800000: extends hot prefix-cache retention from 10 minutes to 30 minutes across editing pauses.
  • --model-hf caches weights under ~/.cache/huggingface/hub automatically; when passing --model <dir>, keep local directories under ~/.cache/ (outside ~/Documents, ~/Desktop, and ~/Downloads) to avoid repeated macOS TCC folder prompts after upgrading the binary.

See docs/serve.md for the full configuration reference, including sampling overrides, speculative decoding, prefix caching, and environment variables.

Connect Coding Agents & SDKs

  • Claude Code (~/.claude/settings.json):

    {
      "env": {
        "ANTHROPIC_BASE_URL": "http://127.0.0.1:8000",
        "ANTHROPIC_AUTH_TOKEN": "local",
        "ANTHROPIC_MODEL": "genie"
      }
    }
  • Codex (~/.codex/config.toml):

    model = "genie"
    model_provider = "genie"
    
    [model_providers.genie]
    name = "Genie"
    base_url = "http://127.0.0.1:8000/v1"
    wire_api = "responses"
    requires_openai_auth = true
  • Pi (~/.pi/agent/models.json):

    {
      "providers": {
        "genie": {
          "api": "openai-completions",
          "baseUrl": "http://127.0.0.1:8000/v1",
          "apiKey": "local",
          "models": [
            {
              "id": "genie",
              "reasoning": true,
              "contextWindow": 98304,
              "promptCache": { "short": 1800 }
            }
          ]
        }
      }
    }
  • OpenAI Chat Completions / Responses API:

    curl -s http://127.0.0.1:8000/v1/chat/completions \
      -H 'Content-Type: application/json' \
      -d '{"model":"genie","messages":[{"role":"user","content":"Hello!"}],"stream":true}'
  • Single-Prompt CLI Generation:

    genie generate --model-hf gpustack/Qwen3.8-27B-Coder390-MLX-4bit-dynamic --prompt "Explain Metal simdgroups:" --max-tokens 128

OpenAI-compatible clients (OPENAI_BASE_URL / base_url) require the /v1 suffix (http://127.0.0.1:8000/v1), whereas Anthropic clients (ANTHROPIC_BASE_URL) omit /v1.

License

Licensed under the MIT License.

About

Ultra-fast, single-binary local LLM & VLM inference engine built natively for Apple Silicon.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages