Repository navigation
TensorFold 0.2.0
TensorFold serves a local LLM on Apple Silicon at an OpenAI-compatible endpoint. Give tensorfold serve a Hugging Face checkpoint, a context window and sampling settings, and it downloads the model, loads it with Metal kernels written for its family and serves /v1/chat/completions.
This release is a rewrite. It replaces the earlier MoE runtime, and that runtime's flags, such as --resident-budget, are gone.
Install
pip install git+https://github.com/ashhart/TensorFold.git@v0.2.0
tensorfold serve Vontra/NVIDIA-Nemotron-3.5-Lightning-30B-A3B-MLX-4bit --context 65536You need a Mac with Apple Silicon, Python 3.11 or newer and MLX 0.31.2 or newer. Point any OpenAI client at http://127.0.0.1:8080/v1.
Models
| Model | Checkpoint | Measured decode |
|---|---|---|
| Nemotron 3.5 Lightning 30B-A3B | Vontra/NVIDIA-Nemotron-3.5-Lightning-30B-A3B-MLX-4bit, MTP head included |
188-206 tok/s on short answers, measured before MTP drafts, M5 Max |
| Qwen3.8-27B | Vontra/Qwen3.8-27B-MLX-4bit with the z-lab/Qwen3.8-27B-DFlash2 drafter |
120-124 tok/s on short answers, 189 on code, M5 Max |
| Qwen3.8 Flash Next | Vontra/Qwen3.8-Flash-Next-MLX-4bit-MTP |
88-92 tok/s on short answers, 110 on code, M3 Ultra |
Nemotron now drafts with its MTP head by default. In-engine that reached 217 tok/s on prose and 228 on code.
What's in it
tensorfold serve,pull,modelsandinfo. Models load from the Hugging Face cache or a local directory.- Drafting that doesn't change the output. A drafted reply matches one-token-at-a-time decoding byte for byte; send
"draft": falseto compare. - Drafts per family: DFlash2 draft trees for the 27B, MTP heads for Flash Next and Nemotron, and copies of earlier context for all three.
- Prompt caching. Recent conversation prefixes stay in memory, and system blocks are saved to disk across restarts.
- A thinking budget, a context cap that refuses longer prompts with HTTP 400, and sampling defaults read from each checkpoint's
generation_config.json. - A recipe book with what worked and what failed for each family and how to add your own, and a runbook for setting up with an AI agent.
Known limits
- On an M5, MLX 0.32.2 fails Nemotron's row check at load, so Nemotron runs without drafts. The output is the same, only slower.
pip install mlx==0.31.2restores drafts. - The Qwen3.8-27B lane kernels need an M5-generation GPU. On older chips it runs on MLX's kernels, and a drafted reply can differ from a serial one.
- For Flash Next and Nemotron, a reply can depend on which prompt prefix was already cached.