ggml-org/llama.cpp在自己电脑上跑大模型的开源工具,帮你在本地运行 AI 模型
llama.cpp 是一个开源工具,目的是让普通电脑也能跑起大语言模型(就是像 ChatGPT 背后那种会聊天、会写作的 AI)和能看图的视觉模型。它的最大好处是需要的准备工作少,适配的硬件范围广,可以完全在本地运行,数据不用发到别人的服务器上。
它用 C/C++ 写成,不依赖别的库,对苹果芯片做了专门的加速,也支持 NVIDIA、AMD 等显卡,甚至能在内存不够时让处理器和显卡分工干活。装好后可以直接用命令行和模型对话,还自带一个网页界面,也能把它当接口服务调用。
普通用户在电脑上装好后,用命令行工具直接和本地模型进行对话。
通过内置的聊天应用连接本地服务,像用聊天软件一样和模型交流。
用命令行工具加载多模态模型,进行带图片的对话会话。
有多块显卡的用户可以按文档配置多显卡,一起分担模型计算。
案例来自项目官方说明里举的例子和演示,不是本站编的。
用之前要准备:需要一台性能尚可的电脑;要用显卡加速的话需要对应显卡驱动;部分模型能用压缩版降低内存占用,但大模型仍要求较高内存或显存
下载链接直接指向 GitHub 官方发布页的文件,不经过本站。国内下载 GitHub 文件可能偏慢。
也可以用命令装:
curl -LsSf https://llama.app/install.sh | sh irm https://llama.app/install.ps1 | iex 命令原样摘自项目官方说明,本站没有改动。
随便用、随便改,也能用在公司产品里,只要保留原作者的版权声明。
以上是对许可证的通俗解释,不是法律意见;正式商用以官方仓库的 LICENSE 文件为准。
不要,项目是 MIT 开源许可,可以免费使用,也能用于商业场景。
不是必须,CPU 也能跑;但想速度快、跑大一点的模型,最好有独立显卡。
能,官方提供 Windows 安装包,macOS、Linux、Android 也都有对应版本。
项目主打本地运行,模型和数据都在你自己机器上,不需要上传到外部服务。
能不能用中文主要看加载的模型本身,工具不限制语言,选支持中文的模型即可。
下面是海外开发者在 Hacker News(国外程序员常去的技术论坛)上讨论这个项目的真实评论,按讨论热度挑选,中文由 AI 翻译,点「看原文」可以对照英文。
It's hard to overstate the impact Georgi Gerganov and llama.cpp have had on the local model space. He pretty much kicked off the revolution in March 2023, making LLaMA work on consumer laptops. Here's that README from March 10th 2023 https://github.com/ggml-org/llama.cpp/blob/775328064e69db1ebd7e19ccb59d2a7fa6142470/README.md > The main goal is to run the model using 4-bit quantization on a MacBook. [...] This was hacked in an evening - I have no idea if it works correctly. Hugging Face have been a great open source steward of Transformers, I'm optimistic the same will be true for GGML. I wrote a bit about this here: https://simonwillison.net/2026/Feb/20/ggmlai-joins-hugging-face/
Can anyone point me in the direction of getting a model to run locally and efficiently inside something like a Docker container on a system with not so strong computing power (aka a Macbook M1 with 8gb of memory)? Is my only option to invest in a system with more computing power? These local models look great, especially something like https://huggingface.co/AlicanKiraz0/Cybersecurity-BaronLLM_Offensive_Security_LLM_Q6_K_GGUF for assisting in penetration testing. I've experimented with a variety of configurations on my local system, but in the end it turns into a make shift heater.
How does this compare to using a multimodal model like gemma3 via ollama? Any benefit on a Mac with apple silicon? Any experiences someone could share?
It works super well! You'll have to compile llama.cpp from source, and you should get a llama-mtmd-cli program. I made some quants with vision support - literally run: ./llama.cpp/llama-mtmd-cli -hf unsloth/gemma-3-4b-it-GGUF:Q4_K_XL -ngl -1 ./llama.cpp/llama-mtmd-cli -hf unsloth/gemma-3-12b-it-GGUF:Q4_K_XL -ngl -1 ./llama.cpp/llama-mtmd-cli -hf unsloth/gemma-3-27b-it-GGUF:Q4_K_XL -ngl -1 ./llama.cpp/llama-mtmd-cli -hf unsloth/unsloth/Mistral-Small-3.1-24B-Instruct-2503-GGUF:Q4_K_XL -ngl -1 Then load the image with /image image.png inside the chat, and chat away! EDIT: -ngl -1 is not needed anymore for Metal backends (CUDA still yes) (llama.cpp will auto offload to the GPU by default!). -1 means all GPU layers offloaded to the GPU.
I appreciate Mistral (and others) releasing their weights for free. But given how llama.cpp underpins a lot of the programs which allow users to run open weight models, it is a little frustrating to have companies which brag about releasing models to the community, leave the community to their own devices to slowly try and actually implement their models. I hear the reason for this is that llama.cpp keeps breaking basic things, so they have become an unreliable partner. Seems this is what Ollama is trying to address by diluting their connections to llama.cpp and directly contacting companies training these models to have simultaneous releases (e.g. GPT-OSS).
数据来自 GitHub,本站每周核对一次,最近核对于 2026-11-22。