TinkerLab
ARTIFACT // TUNE-MAC-STUDIO-ULTRA-LLM.SH (SHELL)

Mac Studio M3 Ultra (256GB/512GB) Metal Wired Ceiling & MLX Frontier MoE Launcher (tune-mac-studio-ultra-llm.sh)

Raises macOS iogpu.wired_limit_mb up to 475GB on 512GB Mac Studio M3 Ultra, checks Thunderbolt 5 RDMA/Bridge0 peer status, and launches mlx_lm.server for DeepSeek-R1-671B or Qwen3-235B-A22B.

[KEY VERIFIED TAKEAWAY / TL;DR]This reproducible configuration artifact "Mac Studio M3 Ultra (256GB/512GB) Metal Wired Ceiling & MLX Frontier MoE Launcher" (tune-mac-studio-ultra-llm.sh, SHELL) is paired with Tinker AI Lab's hardware-verified guide "mac-studio-m3-ultra-512gb-deepseek-r1-671b-qwen3-235b-mlx-benchmark". It exposes 3 customizable browser variables (WIRED_LIMIT_MB=486400, MLX_MODEL_REPO=mlx-community/Qwen3-235B-A22B-4bit, BIND_PORT=8080) with loopback-first security defaults.
01 // HOMELABLocal AI / HomeLab· Verified: 2026-10-28
Browse All 42 Artifacts →
tune-mac-studio-ultra-llm.sh

Mac Studio M3 Ultra (256GB/512GB) Metal Wired Ceiling & MLX Frontier MoE Launcher

Raises macOS iogpu.wired_limit_mb up to 475GB on 512GB Mac Studio M3 Ultra, checks Thunderbolt 5 RDMA/Bridge0 peer status, and launches mlx_lm.server for DeepSeek-R1-671B or Qwen3-235B-A22B.

View Paired Guide →
Customizable Variables (Saved in Browser)
UTF-8 Encoded · Live Client-Side Compilation
#!/usr/bin/env bash
# Tinker AI — Mac Studio M3 Ultra (256GB/512GB · 819GB/s) Metal Ceiling & MLX Launcher (Guide #25)
set -euo pipefail

TARGET_MB="486400"
MODEL_REPO="mlx-community/Qwen3-235B-A22B-4bit"
PORT="8080"

echo "=== [1/3] Raising macOS Metal Wired Memory Ceiling to $TARGET_MB MB ==="
CURRENT_MB=$(sysctl -n iogpu.wired_limit_mb 2>/dev/null || echo "0")
echo "Current iogpu.wired_limit_mb: $CURRENT_MB MB"
sudo sysctl -w iogpu.wired_limit_mb="$TARGET_MB"

echo "=== [2/3] Verifying Zero Swap Pressure & Thunderbolt 5 Bridge ==="
sysctl vm.swapusage
ifconfig bridge0 2>/dev/null | grep -E "inet|mtu" || echo "Single-node mode (no Thunderbolt 5 bridge0 active)"

echo "=== [3/3] Starting MLX OpenAI-Compatible Server on 127.0.0.1:$PORT ==="
python3 -m mlx_lm.server \
  --model "$MODEL_REPO" \
  --host 127.0.0.1 \
  --port "$PORT"
PARAMETER SPECIFICATION // 参数化变量规范说明表

Customizable Parameter Reference for tune-mac-studio-ultra-llm.sh

This SHELL artifact exposes 3 template variables compiled client-side in your browser.

Template TokenParameter DescriptionVerified DefaultExample Format
{{WIRED_LIMIT_MB}}Metal Wired Memory Ceiling (MB)486400486400 (475GB for 512GB Mac) or 229376 (224GB for 256GB Mac)
{{MLX_MODEL_REPO}}MLX Model HuggingFace Repo / Local Pathmlx-community/Qwen3-235B-A22B-4bitmlx-community/DeepSeek-R1-4bit or mlx-community/Qwen3-235B-A22B-4bit
{{BIND_PORT}}Local Loopback API Port80808080
PAIRED HARDWARE MANIFEST // 配套实测环境与边界记录

Verified Environment for "Apple Mac Studio M3 Ultra (512GB / 256GB · 819 GB/s) Benchmark: Running Full DeepSeek-R1-671B & Qwen3-235B-A22B with MLX vs llama.cpp"

Tested Hardware & OS

Mac Studio M3 Ultra (32C CPU / 80C GPU, 512GB Unified Memory @ 819 GB/s) + Mac Studio M3 Ultra (256GB @ 819 GB/s) · macOS 15.5 Sequoia

Pinned Stack & Model Versions
mlx-lm 0.22.1 (MLX 0.24.0)llama.cpp b4910 (Metal Backend)DeepSeek-R1-671B (4-bit MLX & Q4_K_M GGUF)Qwen3-235B-A22B (4-bit MLX & Q4_K_M GGUF)
Offline Boundary (100% Air-Gapped Capable)

Once the ~378GB–404GB model shards are cached on local NVMe or Thunderbolt 5 DAS, inference runs 100% offline on loopback.

Known Operational Limits & Failure Modes
  • macOS defaults to ~75% Metal wired limit (~384GB on a 512GB Mac); loading a 404GB DeepSeek-R1-671B Q4_K_M model without raising `iogpu.wired_limit_mb` fails or swaps.
  • Prompt prefill (PP512) on 671B MoE takes ~5.8s (~88 tok/s) on a single M3 Ultra because 37B active parameters are evaluated per token; keep system prompts cached via prefix caching.
DEPLOYMENT CHECKLIST // 配置落地核验步骤

3-Step Verification Checklist After Deploying tune-mac-studio-ultra-llm.sh

  1. Raised `iogpu.wired_limit_mb` via `sysctl` (`486400` on 512GB Mac or `229376` on 256GB Mac) before loading >120GB models.
  2. Verified `sysctl vm.swapusage` shows `used = 0.00M` during 16K–64K context generation.
  3. Selected 4-bit MLX (`mlx-lm`) for maximum MoE token speed on macOS, or GGUF `Q4_K_M` with `-fa -ctk q8_0 -ctv q8_0` in `llama.cpp`.