> ## Content Index
> Fetch the complete content index at: https://www.hubwiz.com/blog/llms.txt
> Use this file to discover other available public pages before exploring further.

# MacBook实测Qwen2.5-Coder-32B
- URL: https://www.hubwiz.com/blog/qwen2-5-coder-32b-test-on-macbook/
- Published: 2024-11-13T13:17:35.000Z
- Updated: 2024-11-13T13:18:37.000Z
- Description: Qwen2.5-Coder-32B 是一款可以在我的 Mac 上运行的、可以很好地编写代码的 LLM。
- Author: admin
- Tags: MODEL-ZOO, QWEN2.5-CODER, LLM-GGUF, OLLAMA, MLX, LLM-OLLAMA, MLX-LLM, #Import 2026-10-14 14:41

阿里巴巴 Qwen 研究团队发布的新 [Qwen2.5-Coder 系列开源LLM](https://qwenlm.github.io/blog/qwen2.5-coder-family/?ref=hubwiz.com)（Apache 2.0 许可）引起了广泛关注。乍一看，这种关注似乎是当之无愧的。

Qwen 声称：

> Qwen2.5-Coder-32B-Instruct 已成为当前的 SOTA 开源代码模型，与 GPT-4o 的编码能力相匹配。

对于一个足够小的 32B 模型来说，这是一个很大的声明，它可以在我的 64GB MacBook Pro M2 上运行。 Qwen 发布的分数看起来令人印象深刻，在各种代码相关基准测试中与 GPT-4o 和 Claude 3.5 Sonnet（2024 年 10 月）版本相比均表现出色：

![](https://www.hubwiz.com/blog/content/images/2024/11/image-1023.png)

在基准测试比较中，Qwen 2.5 Coder（32B Instruct）在 LiveCodeBench、Spider 和 BIRD-SQL 指标上的表现优于 GPT-4o 和 Claude 3.5 Sonnet，在 MBPP、Aider 和 CodeArena 上落后，在 MultiPL-E 上显示出好坏参半的结果，在 HumanEval 和 McEval 基准测试中的表现也类似。

其他研究人员的基准测试怎么样？Paul Gauthier 的 [Aider 基准测试](https://aider.chat/docs/leaderboards/?ref=hubwiz.com)享有盛誉，[Paul 报告](https://twitter.com/paulgauthier/status/1856018124031832236?ref=hubwiz.com)称：

> 新的 Qwen 2.5 Coder 模型在 aider 的代码编辑基准测试中表现非常出色。32B Instruct 模型的得分介于 GPT-4o 和 3.5 Haiku 之间，84% 3.5 Sonnet、75% 3.5 Haiku、74% Qwen2.5 Coder 32B、71% GPT-4o、69% Qwen2.5 Coder 14B、58% Qwen2.5 Coder 7B

![](https://www.hubwiz.com/blog/content/images/2024/11/image-1024.png)

这是针对 Aider“整体编辑”基准测试的。“diff”基准测试[得分也不错](https://twitter.com/paulgauthier/status/1856042640279777420?ref=hubwiz.com)，Qwen2.5 Coder 32B 与 GPT-4o 持平（但略低于 Claude 3.5 Haiku）。

鉴于这些分数（以及[ Reddit 上的积极评价](https://www.reddit.com/r/LocalLLaMA/comments/1gp84in/qwen25coder%5F32b%5Fthe%5Fai%5Fthats%5Frevolutionizing/?ref=hubwiz.com)），我不得不亲自尝试一下。

我尝试使用[ llm-gguf ](https://github.com/simonw/llm-gguf?ref=hubwiz.com)运行 [Qwen/Qwen2.5-Coder-32B-Instruct-GGUF Q8](https://huggingface.co/Qwen/Qwen2.5-Coder-32B-Instruct-GGUF?ref=hubwiz.com)，但速度有点太慢了，因为我目前没有编译它来使用我的 Mac 的 GPU。

但是[ Ollama](https://ollama.com/?ref=hubwiz.com) 版本和 [MLX ](https://github.com/ml-explore/mlx?ref=hubwiz.com)版本都运行良好！

我使用以下命令安装了 Ollama 版本：

```
ollama pull qwen2.5-coder:32b
```

这获取了一个 20GB 的量化文件。我使用我的 LLM 工具和 Sergey Alexandrov 的 [llm-ollama ](https://github.com/taketwo/llm-ollama?ref=hubwiz.com)插件运行了一个提示，如下所示：

```
llm install llm-ollama
llm models # Confirming the new model is present
llm -m qwen2.5-coder:32b 'python function that takes URL to a CSV file and path to a SQLite database, fetches the CSV with the standard library, creates a table with the right columns and inserts the data'
```

这是[结果](https://gist.github.com/simonw/0a47f9e35a50d4e25a47826f4ab75dda?ref=hubwiz.com)。代码有效，但我必须先解决一个令人沮丧的 ssl 错误（如果我允许模型使用 `requests`或 `httpx` 而不是标准库，这不会成为问题）。

我还尝试使用 Apple Silicon 快速阵列框架 MLX，我 直接使用 [mlx-llm](https://github.com/riccardomusmeci/mlx-llm?ref=hubwiz.com) 库来运行它，通过 [uv](https://github.com/astral-sh/uv?ref=hubwiz.com) 运行如下：

```
uv run --with mlx-lm \
  mlx_lm.generate \
  --model mlx-community/Qwen2.5-Coder-32B-Instruct-8bit \
  --max-tokens 4000 \
  --prompt 'write me a python function that renders a mandelbrot fractal as wide as the current terminal'
```

这给了我一个[非常令人满意的结果](https://gist.github.com/simonw/1cc1e0418a04dbd19cd281cf9b43666f?ref=hubwiz.com)——当我在终端中运行它生成的代码时，我得到了这个：

![](https://www.hubwiz.com/blog/content/images/2024/11/image-1025.png)

macOS 终端窗口以 ASCII 艺术形式显示令人愉悦的曼德布洛特分形

这是一个非常有前途的开发。32GB 足够小，我可以在 Mac 上运行模型，而不必退出我正在运行的所有其他应用程序，而且结果的速度和质量都与当前最好的托管模型相媲美。

鉴于代码辅助目前大概占我 LLM 使用量的 80% 左右，这对于我如何使用这类技术来说是一个非常有用的版本。

---

原文链接：[Qwen2.5-Coder-32B is an LLM that can code well that runs on my Mac](https://simonwillison.net/2024/Nov/12/qwen25-coder/?ref=hubwiz.com)

汇智网翻译整理，转载请标明出处