Skip to content

feat(mac): native Apple Silicon run (Metal) + BACKEND={llamacpp|mlx} - #15

Open
soobrosa wants to merge 2 commits into
hanxiao:mainfrom
soobrosa:feat/apple-silicon-mac
Open

feat(mac): native Apple Silicon run (Metal) + BACKEND={llamacpp|mlx}#15
soobrosa wants to merge 2 commits into
hanxiao:mainfrom
soobrosa:feat/apple-silicon-mac

Conversation

@soobrosa

Copy link
Copy Markdown

What

Adds a Docker-free, no-NVIDIA way to run the Knowledge Graph Extractor on an Apple Silicon Mac, plus an opt-in faster MLX backend. No change to the extraction/UI/scheduler logic: the model stays decoupled behind the OpenAI-compatible LLAMA_URL.

  • scripts/mac-run.sh - launches Homebrew llama-server (Metal) on :8080, waits for /health, then starts the app (python app.py) on :3000. Mirrors the docker-compose.yml llama flags (--ctx-size, --spec-type draft-mtp, --cache-reuse) with Metal-appropriate values (--flash-attn on, -ngl 999).
  • BACKEND={llamacpp|mlx} knob - llamacpp is the default; BACKEND=mlx serves :8080 with mlx_lm.server instead, for ~6x faster prefill (the bottleneck on large docs/zips, since each round re-reads the full document). Auto-detects --kv-bits support and auto-caps context to fp16-KV OOM headroom.
  • app.py - the request model label is now MODEL_NAME-configurable (default "qwen3.6", unchanged for the llama.cpp/CUDA path). mlx_lm.server matches the model field against the loaded model, so the MLX path pins it to the model dir.
  • docs/MAC.md - full setup (deps, model download, run, memory tiers, MLX setup + caveats).
  • .env.example / README.md - documented the Mac knobs and linked the guide.

Why

The only documented path today is a single NVIDIA L4 via Docker. This lets people run the whole thing locally on a 32 GB+ Apple Silicon Mac.

Test notes

Tested on an M3 Pro / 36 GB, llama.cpp build 9430 (Homebrew). Q3_K_XL wires ~17 GB; draft-mtp speculative decoding works on build >= 9430. The CUDA/Docker path is untouched (default BACKEND, default MODEL_NAME). Opened as draft for your review of the defaults and whether the MLX backend is in scope.

Daniel Molnar and others added 2 commits June 14, 2026 18:19
…{llamacpp|mlx}

Adds a Docker-free way to run the extractor on an Apple Silicon Mac: Homebrew
llama.cpp serves the model on Metal (:8080), the FastAPI app runs in a local uv
venv (:3000), and the v5-nano dedup embedder stays on CPU. A BACKEND knob can
swap llama.cpp for Apple's mlx-lm for ~6x faster prefill, with KV-bits autodetect
and context auto-cap. app.py's request model label is now MODEL_NAME-configurable
(default 'qwen3.6' unchanged) so mlx_lm.server can match the loaded model.

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
…stream)

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
@soobrosa
soobrosa marked this pull request as ready for review June 14, 2026 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant