一、测试硬件与软件环境
1.1 硬件配置
表格
| 参数项 | 配置详情 |
|---|---|
| 设备机型 | Mac Studio M1 Ultra |
| 处理器 | Apple M1 Ultra(20 核 CPU、64 核 GPU) |
| 统一内存 | 64GB(硬上限,本文所有优化围绕 64G 内存约束) |
| 内存带宽 | 800GB/s |
1.2 软件环境
- 操作系统:macOS Sonoma / Sequoia
- Python:3.11(Homebrew 安装,严格匹配 oMLX 依赖)
- 推理框架:oMLX(CMLX 底层加速)
- 对接客户端:OpenClaw(OpenAI 标准接口)
- 模型源:HuggingFace、ModelScope
二、oMLX 完整部署教程
oMLX 基于 CMLX 底层加速,原生支持 MTP 草稿加速、连续批处理、KV 缓存量化,完美适配 Apple Silicon 统一内存,是 OpenClaw 本地推理最优后端。
2.1 一键自动化安装(国内网络推荐)
国内镜像脚本自动配置 Node.js、Python、OpenClaw 环境,一键执行:
curl -fsSL https://open-claw.org.cn/install.sh | bash安装完成验证环境:
openclaw --version2.2 手动分步安装(自定义环境)
- 安装指定版本 Python3.11
brew install python@3.11- 国内镜像加速拉取 oMLX 源码
git clone https://mirror.ghproxy.com/https://github.com/jundot/omlx.git cd omlx- 本地编译安装主程序(清华 pip 源加速)
/opt/homebrew/bin/pip3.11 install -e . -i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn- 安装 MCP 工具扩展(AIOps 运维必备:文件读取、SSH 远程执行)
/opt/homebrew/bin/pip3.11 install -e ".[mcp]" -i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn- 配置终端别名,简化调用命令
echo "alias omlx='/opt/homebrew/bin/python3.11 -m omlx.cli'" >> ~/.zshrc source ~/.zshrc2.3 模型服务启动基础命令
默认监听 8000 端口,OpenClaw 无需修改接口地址:
omlx serve qwen3.6-27b-4bit2.4 oMLX 完整卸载流程
# 卸载 Python 依赖包 /opt/homebrew/bin/pip3.11 uninstall omlx -y # 删除本地源码目录 rm -rf ~/omlx重要注意:所有命令固定使用
/opt/homebrew/bin/pip3.11,规避系统 Python 版本冲突,全程使用国内镜像源提升下载速度。
三、模型下载方式 & 适配 M1 Ultra 64G 模型清单
3.1 ModelScope 离线下载命令
/opt/homebrew/Cellar/omlx/0.4.1/libexec/bin/modelscope download OsaurusAI/Qwen3.6-35B-A3B-MXFP4-MTP3.2 M1 Ultra 64G 推荐可用模型(按内存友好度排序)
表格
| 模型名称 | 量化格式 | 模型来源 | 64G 内存适配说明 | 适用场景 |
|---|---|---|---|---|
| Qwen3.6-27B-4bit | MLX 4bit | HuggingFace | 内存占用极低,稳定 128K 上下文 | 轻量问答、临时脚本生成 |
| Qwen3.6-27B-mxfp4 | MLX MXFP4 | HuggingFace | 平衡速度与精度,无爆内存风险 | 日常短日志分析 |
| Qwen3.6-27B-MTP-4bit | MLX 4bit+MTP | ModelScope | 多并发批量摘要加速 | 批量小文档汇总 |
| Qwen3.6-35B-A3B-OptiQ-4bit | 分层混合 4bit | HuggingFace | 64G 主力,稳定 128K 上下文,不建议开 262K | 数万行运维日志、故障复盘 |
| Qwen3.6-35B-A3B-MXFP4-MTP | MXFP4+MTP | ModelScope | 单请求性能强,仅裸机关闭所有后台可运行 | 批量日志离线分析 |
避坑提醒:
Qwen3.6-35B-A3B-8bit权重内存占用 35GB,搭配 128K KV 缓存总占用接近 60GB,M1 Ultra 64G 仅能裸机运行,后台开软件极易 OOM,不推荐作为主力。
四、性能基准测试数据(同架构参考,M1 Ultra 64G 性能略低于 192G 机型)
术语释义
- TTFT:首字生成延迟(数值越低响应越快)
- pp TPS:输入文本预填充吞吐量(日志加载速度)
- tg TPS:文本生成输出速度
- Peak Mem:推理峰值内存占用
4.1 Qwen3.6-27B-mxfp4 基准性能
| 测试规格 | TTFT(ms) | TPOT(ms) | pp TPS | tg TPS | 总耗时 E2E (s) | 总吞吐量 | 峰值内存 |
|---|---|---|---|---|---|---|---|
| pp1024/tg128 | 7565.2 | 44.33 | 135.4 | 22.7 | 13.195 | 87.3 tok/s | 15.07 GB |
| pp4096/tg128 | 29204.5 | 46.40 | 140.3 | 21.7 | 35.097 | 120.4 tok/s | 16.49 GB |
| pp8192/tg128 | 58701.3 | 46.54 | 139.6 | 21.7 | 64.612 | 128.8 tok/s | 17.12 GB |
多并发连续批处理对比:
| 并发 Batch | tg TPS | 加速倍数 | pp TPS | TTFT(ms) | 总耗时 |
|---|---|---|---|---|---|
| 1 | 22.7 | 1.00x | 135.4 | 7565.2 | 13.195 |
| 2 | 27.1 | 1.19x | 135.0 | 14990.5 | 24.603 |
| 4 | 29.7 | 1.31x | 134.7 | 29773.2 | 47.667 |
| 8 | 33.0 | 1.45x | 133.2 | 59589.1 | 92.594 |
4.2 Qwen3.6-35B-A3B-4bit 基准性能
表格
| 测试规格 | TTFT(ms) | TPOT(ms) | pp TPS | tg TPS | 总耗时 E2E (s) | 总吞吐量 | 峰值内存 |
|---|---|---|---|---|---|---|---|
| pp1024/tg128 | 1749.4 | 15.55 | 585.4 | 64.8 | 3.724 | 309.4 tok/s | 19.25 GB |
| pp4096/tg128 | 4885.1 | 15.62 | 838.5 | 64.5 | 6.868 | 615.0 tok/s | 20.04 GB |
| pp8192/tg128 | 9511.2 | 17.04 | 861.3 | 59.1 | 11.676 | 712.6 tok/s | 20.35 GB |
并发批处理加速:
| 并发 Batch | tg TPS | 加速倍数 | pp TPS | TTFT(ms) | 总耗时 |
|---|---|---|---|---|---|
| 1 | 64.8 | 1.00x | 585.4 | 1749.4 | 3.724 |
| 2 | 103.5 | 1.60x | 652.9 | 2986.0 | 5.611 |
| 4 | 142.4 | 2.20x | 655.5 | 5786.8 | 9.846 |
| 8 | 180.8 | 2.79x | 648.3 | 11430.6 | 18.299 |
4.3 Qwen3.6-35B-A3B-MXFP4-MTP(开启 MTP)
| 测试规格 | TTFT(ms) | TPOT(ms) | pp TPS | tg TPS | 总耗时 E2E (s) | 总吞吐量 | 峰值内存 |
|---|---|---|---|---|---|---|---|
| pp1024/tg128 | 1298.3 | 27.20 | 788.7 | 37.1 | 4.753 | 242.4 tok/s | 21.78 GB |
| pp4096/tg128 | 2994.6 | 27.29 | 1367.8 | 36.9 | 6.460 | 653.9 tok/s | 22.57 GB |
| pp8192/tg128 | 5638.9 | 24.69 | 1452.8 | 40.8 | 8.774 | 948.2 tok/s | 22.88 GB |
| pp16384/tg128 | 11926.1 | 25.51 | 1373.8 | 39.5 | 15.166 | 1088.7 tok/s | 23.54 GB |
| pp32768/tg128 | 27081.6 | 27.43 | 1210.0 | 36.7 | 30.566 | 1076.2 tok/s | 24.88 GB |
多 Batch 对比:开启 MTP 多并发吞吐量提升最高 4.8 倍,适合批量运维日志批量分析;单条超长文本可关闭 MTP 提升生成速度。
4.4 Qwen3.6-27B-4bit TurboQuant KV Cache
| 测试规格 | TTFT(ms) | pp TPS | tg TPS | E2E(s) | Throughput | Peak Mem |
|---|---|---|---|---|---|---|
| pp1024/tg128 | 7913.6 | 129.4 | 23.9 | 13.261 | 86.9 tok/s | 15.85 GB |
| pp4096/tg128 | 30628.5 | 133.7 | 22.7 | 36.276 | 116.4 tok/s | 17.27 GB |
| pp8192/tg128 | 61665.7 | 132.8 | 22.9 | 67.262 | 123.7 tok/s | 17.90 GB |
| pp16384/tg128 | 125321.2 | 130.7 | 21.3 | 131.341 | 125.7 tok/s | 19.15 GB |
| pp32768/tg128 | 260016.4 | 126.0 | 17.8 | 267.209 | 123.1 tok/s | 21.65 GB |
五、M1 Ultra 64G 高频报错排查方案
5.1 xgrammar 结构化输出缺失报错
报错提示:Structured output requires xgrammar. Reinstall with: brew reinstall omlx --with-grammar解决命令:
brew reinstall omlx --with-grammar5.2 brew link 命令冲突
报错:Target /opt/homebrew/bin/omlx already exists.
rm '/opt/homebrew/bin/omlx' brew link --overwrite omlx5.3 ModelScope 模型下载工具缺失
报错提示未安装 ModelScope SDK
/opt/homebrew/Cellar/omlx/0.4.1/libexec/bin/pip install "omlx[modelscope]" -i https://pypi.tuna.tsinghua.edu.cn/simple5.4 MTP 模型推理卡死
查看 oMLX 日志,确认存在如下日志代表 MTP 正常加载:
2026-06-10 19:00:05,581 - omlx.patches.mlx_lm_mtp.batch_generator - INFO - MTP path activated for uid=0 (model has mtp_forward, batch=1)卡死解决方案:降低ctx-size至 65536,关闭后台占用内存软件。
5.5 Hybrid Attention 模型连续批处理兼容报错
报错:ArraysCache incompatible with --mllm continuous batching解决:启动命令移除--mllm参数,仅纯文本推理无需多模态参数。
5.6 oMLX 版本升级失败
方式 1:brew 升级
brew upgrade omlx brew services stop omlx方式 2:离线安装安装包下载地址:https://github.com/jundot/omlx/releases/download/v0.4.4/oMLX-0.4.4-macos26-27.dmg
5.7 M1 Ultra 64G 专属高频问题:推理内存溢出 OOM
- 切换 OptiQ-4bit 轻量化模型,放弃 8bit 权重;
--ctx-size限制 131072 以内,禁止 262K、320K 超大上下文;- 关闭浏览器、绘图工具、虚拟机等后台程序;
- 设置
--max-batch-size 1单会话运行; - 对话结束执行
/clear清空 OpenClaw 会话 KV 缓存。
六、全文性能总结 & M1 Ultra 64G 选型建议
6.1 各模型综合性能对比
| 模型 | 配置 | 单条生成 tg TPS | 预填充 pp TPS | 峰值内存 | M1 Ultra 64G 推荐度 |
|---|---|---|---|---|---|
| Qwen3.6-27B-mxfp4 | 默认 | 22.7 | 135.4 | 15.07 GB | ⭐⭐⭐⭐⭐ 低配首选 |
| Qwen3.6-35B-A3B-4bit | 默认 | 64.8 | 861.3 | 20.35 GB | ⭐⭐⭐⭐ 主力轻量 |
| Qwen3.6-35B-A3B-MXFP4-MTP | 开启 MTP | 40.8 | 1452.8 | 22.88 GB | ⭐⭐⭐ 仅裸机批量使用 |
| Qwen3.6-35B-A3B-MXFP4-MTP | 关闭 MTP | 56.6 | 1496.9 | 22.39 GB | ⭐⭐⭐ 单长文本使用 |
| Qwen3.6-27B-4bit | TurboQuant KV | 22.9 | 132.8 | 17.90 GB | ⭐⭐⭐ 备用轻量 |
6.2 核心落地结论(M1 Ultra 64G 重点)
- 硬件瓶颈:64GB 统一内存为硬性上限,无法稳定运行 Qwen3.6-35B-A3B 8bit 模型做大上下文分析;
- 最优主力模型:
Qwen3.6-35B-A3B-OptiQ-4bit,平衡精度、内存、长文本理解,适配 AIOps 数万行日志; - MTP 适用场景:批量多会话日志摘要时开启提升吞吐,单次超长日志分析建议关闭 MTP 提升单条生成速度;
- 上下文上限:稳定运行上限 128K token,超过极易 OOM,超长文档必须分段摘要;
- 底层加速:oMLX 基于 CMLX 加速,相比原生 mlx_lm 预填充速度提升 30%+,更适合大量日志输入场景。
七、参考资料
・oMLX 官方仓库:https://github.com/jundot/omlx
・ModelScope 模型仓库:https://modelscope.cn
・HuggingFace 镜像站点:https://hf-mirror.com