@gpustack/genie 0.0.0-stage → 0.1.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +123 -2
- package/bin/genie-darwin-arm64 +4 -0
- package/bin/genie.js +21 -0
- package/package.json +34 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Genie Authors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,124 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Genie
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](./LICENSE)
|
|
4
|
+
[](./docs/serve.md)
|
|
5
|
+
[](./docs/README.md)
|
|
6
|
+
|
|
7
|
+
<img src="./docs/assets/logo.png" width="100" height="100" alt="Genie logo">
|
|
8
|
+
|
|
9
|
+
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.
|
|
10
|
+
|
|
11
|
+
Read the [Serving Guide](./docs/serve.md), [Benchmarking Guide](./docs/bench.md), and [Documentation Index](./docs/README.md) for full details.
|
|
12
|
+
|
|
13
|
+
## Architecture
|
|
14
|
+
|
|
15
|
+

|
|
16
|
+
|
|
17
|
+
- **Clients & Agents**: OpenAI Chat/Responses, Anthropic Messages (Claude Code / Codex CLI), and local CLI streaming text and vision from a single binary.
|
|
18
|
+
- **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.
|
|
19
|
+
- **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.
|
|
20
|
+
- **Apple Silicon Base**: Runs natively across MacBook Pro, Mac mini, Mac Studio, and Mac Pro on Unified Memory (UMA) and local NVMe SSD.
|
|
21
|
+
|
|
22
|
+
## Highlights
|
|
23
|
+
|
|
24
|
+
- **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.
|
|
25
|
+
- **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.
|
|
26
|
+
- **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.
|
|
27
|
+
- **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.
|
|
28
|
+
- **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.
|
|
29
|
+
|
|
30
|
+
## Supported Models
|
|
31
|
+
|
|
32
|
+
Genie supports the following official upstream model architectures and checkpoints on Hugging Face:
|
|
33
|
+
|
|
34
|
+
| Model | Upstream Weights (Hugging Face) | Architecture (`model_type`) | Modalities | Continuous Batching & Prefix Cache | Speculative Decoding |
|
|
35
|
+
| --- | --- | --- | --- | --- | --- |
|
|
36
|
+
| **Inkling-2-Mini** | [`thinkingmachines/Inkling-2-Mini`](https://huggingface.co/thinkingmachines/Inkling-2-Mini) | Looped Sparse MoE + SWA/ShortConv (`inkling2_loop`) | Text + Vision | Yes | DFlash2 |
|
|
37
|
+
| **Hy4-Flash** | [`tencent/Hy4-flash`](https://huggingface.co/tencent/Hy4-flash) | Sparse LatentMoE (512E top-16) + MLA/DSA/SWA + iHC/Engram (`hy_v4_flash`) | Text + Vision | Yes | DFly2 (bundled) |
|
|
38
|
+
| **Qwen3.8-27B** | [`Qwen/Qwen3.8-27B`](https://huggingface.co/Qwen/Qwen3.8-27B) | Dense Hybrid GDN + Full Attn (`qwen3_5`) | Text + Vision | Yes | DFlash2 |
|
|
39
|
+
|
|
40
|
+
> Ready-to-run checkpoints are available in the [`gpustack/genie` Hugging Face collection](https://huggingface.co/collections/gpustack/genie). 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.
|
|
41
|
+
|
|
42
|
+
## Benchmarks
|
|
43
|
+
|
|
44
|
+
### Inkling-2-Mini (4-bit Looped MoE) — Apple M5 Max & M2 Ultra
|
|
45
|
+
|
|
46
|
+
[](./docs/bench.md#inkling-2-mini-4-bit-looped-moe-inkling2_loop--apple-m5-max)
|
|
47
|
+
|
|
48
|
+
### Qwen3.8-27B (4-bit) — Apple M5 Max & M2 Ultra
|
|
49
|
+
|
|
50
|
+
[](./docs/bench.md#apple-m5-max-64-gib-unified-memory-40-gpu-cores)
|
|
51
|
+
|
|
52
|
+
See [docs/bench.md](./docs/bench.md#benchmark-results) for full tables, the [Engine Factory Defaults & Alignment Matrix](./docs/bench.md#engine-factory-defaults--alignment-matrix), and the [Comparison Labeling Convention](./docs/bench.md#comparison-labeling-convention).
|
|
53
|
+
|
|
54
|
+
## Quick Start
|
|
55
|
+
|
|
56
|
+
### Install via npm
|
|
57
|
+
|
|
58
|
+
Requires macOS on Apple Silicon (`arm64`, macOS 11+) and Node.js 18+:
|
|
59
|
+
|
|
60
|
+
```sh
|
|
61
|
+
npm install -g --ignore-scripts @gpustack/genie
|
|
62
|
+
# or: pnpm add -g --ignore-scripts @gpustack/genie
|
|
63
|
+
# or run directly without installing:
|
|
64
|
+
npx @gpustack/genie --version
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Run as a Background Service (macOS LaunchAgent)
|
|
68
|
+
|
|
69
|
+
`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 writes logs to `~/Library/Logs/genie/`:
|
|
70
|
+
|
|
71
|
+
```sh
|
|
72
|
+
# Start in the background (auto-starts on login):
|
|
73
|
+
genie start --model-hf gpustack/Qwen3.8-27B-Coder390/q5-dynamic
|
|
74
|
+
# or with a local model directory:
|
|
75
|
+
genie start --model /path/to/qwen3.8-27b-4bit
|
|
76
|
+
|
|
77
|
+
# Inspect the running launchd service:
|
|
78
|
+
genie ps
|
|
79
|
+
|
|
80
|
+
# Stop and unload the launchd service (no-op if nothing is running):
|
|
81
|
+
genie stop
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Serve in the Foreground
|
|
85
|
+
|
|
86
|
+
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):
|
|
87
|
+
|
|
88
|
+
```sh
|
|
89
|
+
genie serve --model /path/to/qwen3.8-27b-4bit
|
|
90
|
+
# or download directly from Hugging Face Hub (supports optional /subdir and @revision):
|
|
91
|
+
genie serve --model-hf gpustack/Qwen3.8-27B-Coder390/q5-dynamic
|
|
92
|
+
# optionally pair with a separate Hugging Face DFlash2 drafter:
|
|
93
|
+
genie serve --model-hf owner/model --speculative-hf owner/drafter
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Genie 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.
|
|
97
|
+
|
|
98
|
+
### Connect Coding Agents & SDKs
|
|
99
|
+
|
|
100
|
+
- **Claude Code (Anthropic Messages API)**:
|
|
101
|
+
|
|
102
|
+
```sh
|
|
103
|
+
ANTHROPIC_BASE_URL=http://127.0.0.1:8000 \
|
|
104
|
+
ANTHROPIC_API_KEY=local \
|
|
105
|
+
claude --model qwen3.8-27b-4bit
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
- **OpenAI Chat Completions / Responses API**:
|
|
109
|
+
|
|
110
|
+
```sh
|
|
111
|
+
curl -s http://127.0.0.1:8000/v1/chat/completions \
|
|
112
|
+
-H 'Content-Type: application/json' \
|
|
113
|
+
-d '{"model":"qwen3.8-27b-4bit","messages":[{"role":"user","content":"Hello!"}],"stream":true}'
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
- **Single-Prompt CLI Generation**:
|
|
117
|
+
|
|
118
|
+
```sh
|
|
119
|
+
genie generate --model /path/to/qwen3.8-27b-4bit --prompt "Explain Metal simdgroups:" --max-tokens 128
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## License
|
|
123
|
+
|
|
124
|
+
Licensed under the [MIT License](./LICENSE).
|
package/bin/genie.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { spawnSync } from 'node:child_process';
|
|
3
|
+
import { dirname, join } from 'node:path';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
5
|
+
|
|
6
|
+
if (process.platform !== 'darwin' || process.arch !== 'arm64') {
|
|
7
|
+
console.error(`@gpustack/genie requires macOS Apple Silicon (darwin/arm64); current host is ${process.platform}/${process.arch}.`);
|
|
8
|
+
process.exit(1);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
12
|
+
const binary = join(here, 'genie-darwin-arm64');
|
|
13
|
+
const result = spawnSync(binary, process.argv.slice(2), { stdio: 'inherit' });
|
|
14
|
+
if (result.error) {
|
|
15
|
+
console.error(result.error.message);
|
|
16
|
+
process.exit(1);
|
|
17
|
+
}
|
|
18
|
+
if (result.signal) {
|
|
19
|
+
process.kill(process.pid, result.signal);
|
|
20
|
+
}
|
|
21
|
+
process.exit(result.status ?? 1);
|
package/package.json
CHANGED
|
@@ -1,6 +1,36 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gpustack/genie",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0-rc.2",
|
|
4
|
+
"description": "Ultra-fast local LLM inference engine for Apple Silicon",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"os": [
|
|
8
|
+
"darwin"
|
|
9
|
+
],
|
|
10
|
+
"cpu": [
|
|
11
|
+
"arm64"
|
|
12
|
+
],
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "git+https://github.com/gpustack/genie.git"
|
|
16
|
+
},
|
|
17
|
+
"homepage": "https://github.com/gpustack/genie",
|
|
18
|
+
"bugs": {
|
|
19
|
+
"url": "https://github.com/gpustack/genie/issues"
|
|
20
|
+
},
|
|
21
|
+
"engines": {
|
|
22
|
+
"node": ">=18"
|
|
23
|
+
},
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"access": "public",
|
|
26
|
+
"provenance": true
|
|
27
|
+
},
|
|
28
|
+
"bin": {
|
|
29
|
+
"genie": "./bin/genie.js"
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"bin/",
|
|
33
|
+
"LICENSE",
|
|
34
|
+
"README.md"
|
|
35
|
+
]
|
|
36
|
+
}
|