llamafile
Mozilla-Ocho / llamafile
把 llama.cpp 与模型权重打包成单个可执行文件,跨 macOS/Windows/Linux/BSD 运行,无需安装 Python。Package llama.cpp and model weights into a single executable that runs on macOS, Windows, Linux and BSD without Python.
为什么选Why choose it
- 分发本地模型 demo 的最简方式:一个文件、双击即跑,适合离线演示和取证。One file to distribute; no Python environment.
- CPU/GPU 都能用,不依赖容器或包管理器,现场演示失败率低。Runs across desktop operating systems.
- 底层仍是 llama.cpp,方便对照 GGUF 量化与后端差异。Good for offline demos and air-gapped machines.
不适合Not for
生产多用户 serving 或需要动态 batching 的场景;它是单机便携方案。You need multi-user serving or GPU scaling.
需要频繁换模型/换参数的研究工作流,Ollama 或 llama.cpp 更灵活。Your model is too large for the target machine.
最小上手Minimum setup
- 下载对应平台的 .llamafile,确认执行权限。Download a small llamafile and run it locally.
- 双击或 ./model.llamafile -p 起服务,浏览器打开本地端口。Open the built-in web UI and send one prompt.
- 换一个较小量化文件,记录 CPU/GPU 下的 tokens/s 与内存。Check memory and startup time on the oldest machine you support.
依赖与成本Dependencies and cost
无 Python/容器依赖;模型权重可内嵌;GPU 加速需对应驱动。Check runtime, model weights and external service dependencies in the README.
许可与使用边界License and usage boundaries
代码 Apache-2.0;内嵌模型权重可能另有条款,分发前核对。Code is NOASSERTION; model weights, training data and generated content may have separate terms — check each before commercial use.
开源不等于可商用:GPL / AGPL 有传染性;代码许可、模型许可、生成内容许可要分开看。上线前读仓库 LICENSE 与模型卡,必要时让法务确认。Open source is not automatically commercial-use friendly: GPL / AGPL are copyleft; code, model and output licenses are separate. Read the LICENSE and model card before launch, and involve legal when needed.
替代与相邻Alternatives and neighbors
- llama.cpp — 本地优先Local-first,C/C++ 推理引擎,CPU、Apple Silicon、消费级 GPU 都能跑,量化格式丰富。A C/C++ inference engine that runs on CPUs, Apple Silicon and consumer GPUs, with a wide range of quantisation formats.
- Ollama — 先试这个Start here,一条命令拉模型、跑本地推理,自带模型库与 OpenAI 兼容 API。Pull and run local models with one command, with a built-in model library and an OpenAI-compatible API.
- MLC LLM — 本地优先Local-first,基于 TVM 的通用 LLM 编译部署引擎,可把模型编译到 CUDA、ROCm、Metal、Vulkan、WebGPU 等后端。A TVM-based compiler and deployment engine that compiles LLMs to CUDA, ROCm, Metal, Vulkan and WebGPU backends.
下一步Next steps
- 打开 GitHub,先读 README、LICENSE、最近 release 与 issue。Open GitHub and read the README, LICENSE, latest release and issues first.
- 按“部署依赖 / 显存 / 数据 / 网络 / 权限”列一张上手清单。Make an onboarding checklist for deployment dependencies, VRAM, data, network and permissions.
- 用一个小样本跑通,再决定是否进生产;不要直接上生产数据。Run a small sample first, then decide on production; never start with production data.
GitHub 仓库 ↗GitHub repository ↗ 文档 ↗Docs ↗ 加入对比Add to compare