whichllm README

项目的 README,来自 github.com/Andyyyy64/whichllm。合并为一个 markdown 文件:README.md。

whichllm

PyPI version Python 3.11+ License: MIT Tests Sponsor

Andyyyy64%2Fwhichllm | Trendshift Hacker News rank via HackerGit
Certified AI slop™, as reviewed by Hacker News.
(Joking. With a lot of help from contributors, we're working hard to un-slop it.)

The smartest model your PC can actually run, including ones you didn't know it could.

whichllm reads your GPU, RAM and memory bandwidth, works out which open models fit and how fast each one will generate, and ranks them by benchmark results. Then it prints the command that runs the top pick the way it was estimated.

日本語版はこちら

Quick start

uvx whichllm@latest

Shopping for a GPU? Simulate one:

uvx whichllm@latest --gpu "RTX 4090"

To keep it around:

uv tool install whichllm
brew install andyyyy64/whichllm/whichllm
pip install whichllm

Example

A desktop with an 8 GB RTX 4060 and 32 GB of DDR4 (output trimmed):

$ whichllm

 #  Model                         Quant   Fit       Speed     Score
 1  Qwen/Qwen3.6-35B-A3B          Q6_K    GPU+RAM   16 tok/s   68.8
 2  unsloth/gemma-4-12b-it-GGUF   IQ4_XS  Full GPU  37 tok/s   68.1
 3  google/gemma-4-26B-A4B-it     Q4_K_M  GPU+RAM   11 tok/s   64.5
 4  Qwen/Qwen3.5-9B               Q5_K_M  Full GPU  36 tok/s   64.2
 5  zai-org/GLM-4.7-Flash         Q5_K_M  GPU+RAM   15 tok/s   62.3

  #1 Qwen3.6-35B-A3B also stands in for older generations of its line:
  Qwen3.5-35B-A3B, Qwen3-30B-A3B, Qwen_Qwen3-30B-A3B-Instruct-2507-GGUF

  Run #1 with llama.cpp:
    llama-server -hf unsloth/Qwen3.6-35B-A3B-GGUF:Q6_K -c 4096 -ngl 99 --n-cpu-moe 35 -fa on

The top pick is a 35B model on an 8 GB card. It is a mixture-of-experts model, so each token only uses about 3B of its parameters. whichllm keeps attention, the shared weights and the KV cache in VRAM and leaves the experts of 35 of its 40 layers in system RAM, which is what llama.cpp's --n-cpu-moe does. The speed estimate counts only what each token reads from each place. A fits-in-VRAM check would have skipped the model, and treating it as a plain partial offload would have rated it far too slow.

On a 24 GB RTX 4090 the same logic picks Qwen3.8-27B, although Qwen3-32B also fits there at Q4_K_M. The 27B is the newer generation of the same model line at about the same size and scores higher on current benchmarks, so the 32B is not listed separately; the note under the table names it.

Speeds are estimates from memory bandwidth, not measurements of your machine. The table marks how confident each estimate is.

Here is one checked on real hardware. On a 16 GB RTX 5080 with DDR5-5600, whichllm estimates 70 tok/s for Qwen3.6-35B-A3B at Q4_K_M, with this command:

llama-server -hf unsloth/Qwen3.6-35B-A3B-GGUF:Q4_K_M -c 4096 -ngl 99 --n-cpu-moe 15 -fa on

It measured 79 tok/s on llama.cpp b11977, from a 22 GB file on a 16 GB card. whichllm bench runs the same comparison on your machine.

How it ranks

Quality comes from Artificial Analysis and LiveBench, put on one scale and averaged. --profile coding, math and vision rank on benchmarks for that task instead, such as SciCode and LiveCodeBench for coding. The Open LLM Leaderboard and Chatbot Arena are frozen, so they only score models nothing current covers, and older generations are demoted. Each match records how it was found (the exact repo, its base model, a same-family interpolation, or the uploader's own claim) and weaker matches count for less. whichllm never recommends pretrain-only base checkpoints.

To check the fit, memory is counted as weights plus a KV cache computed layer by layer from the model's config.json (grouped-query and latent attention, sliding windows, recurrent layers), plus runtime buffers. When a model does not fit in VRAM, a mixture-of-experts model first moves experts to RAM; any other model spills whole layers.

Speed is bound by memory bandwidth: the GPU reads its share of the weights at VRAM speed and the CPU reads the rest at RAM speed. Both sides are calibrated against llama.cpp runs. Every placement is held to 8 tok/s: below that, a model's quality is scaled down, so a stronger model that would answer at 3 tok/s does not outrank one that answers at 25.

The details are in Scoring and How it works.

How we test recommendations

A wrong recommendation is a bug, so the rankings have regression tests: tests/golden/.

If whichllm picks something you would not run on your hardware, open an issue with the output. The 6 GB and RTX 3060 archetypes started as reports like that (#76, #104).

Commands

whichllm                          # best models for this machine
whichllm --gpu "RTX 5060 Ti"      # simulate a GPU (add --vram 16 for a variant)
whichllm --gpu "2x RTX 3090"      # or several
whichllm --profile coding         # general, coding, vision, math, any
whichllm --context-length 64k     # long context changes what fits
whichllm --gpu-only               # only models that fit entirely in VRAM
whichllm --speed usable           # hide anything under 8 tok/s
whichllm --markdown               # pasteable table for issues and chats
whichllm --json                   # rows include placement and the run recipe

whichllm hardware                 # what was detected
whichllm engines                  # which inference engines run here
whichllm plan "qwen3 32b"         # what GPU a model needs
whichllm upgrade "RTX 4090" "RTX 5090"   # compare against candidate GPUs
whichllm run                      # download the top pick and chat with it
whichllm bench                    # measure the top pick on this machine
whichllm report                   # share that measurement in a GitHub issue
whichllm snippet                  # print Python that loads the top pick

Every option is in the CLI reference.

If LM Studio complains that a pick is slightly too large, ask for a more conservative fit:

whichllm --gpu-only --speed usable --vram-headroom 1.5GB

If an integrated GPU or unified memory is detected with the wrong limits, override them with --vram and --ram-bandwidth (see Hardware).

Run and snippet

whichllm run downloads the model and opens a chat. Without a model name it takes the top pick.

run demo

whichllm run
whichllm run "qwen 2.5 1.5b gguf"
whichllm run "phi 3 mini gguf" --cpu-only

With llama.cpp installed (brew install llama.cpp, winget install ggml.llamacpp), a GGUF model runs in its llama-cli with the flags of the printed recipe, so the chat uses the GPU and keeps MoE experts in RAM the way the ranking estimated. A named model is left to llama.cpp's automatic fit.

A GGUF model already installed in LM Studio is opened from that library instead of being downloaded again; whichllm recommend marks those rows Installed. Pass --lm-studio-path (repeatable) for a legacy or custom library:

whichllm run "qwen 2.5 1.5b gguf" --lm-studio-path /mnt/models/lm-studio

Without llama-cli, run creates a throwaway environment with uv and uses llama-cpp-python for GGUF models and transformers for the rest. PyPI only ships llama-cpp-python as source, so the first run compiles it, which took 22 minutes on a Core Ultra 9, and that build runs on the CPU only. See Run and snippet.

Where the data comes from

whichllm reads a prebuilt index: the Hugging Face model list, each family's config.json and the merged benchmark scores, rebuilt daily on GitHub Actions and published only if it passes quality checks. A cold start takes about a second and makes no Hugging Face API calls. --live fetches everything directly instead, and HF_TOKEN is used when set.

Documentation

Development

git clone https://github.com/Andyyyy64/whichllm.git
cd whichllm
uv sync --locked --dev
uv run whichllm
uv run pytest

Ranking changes need a look at the golden snapshot: uv run python scripts/update_golden.py report. See CONTRIBUTING.md.

Support

If whichllm saved you a bad download or a bad hardware purchase, sponsoring helps keep it maintained: hardware reports, benchmark updates, packaging and support for more machines. It stays open source either way.

A star helps other people find it. I'd also like to hear what it picked for your machine, so feel free to drop it in Issues.

Star History

Star History Chart

License

MIT

whichllm (Andyyyy64/whichllm)

正在搜索数据库…

这是什么?一个命令行工具,帮你找到最适合你电脑的本地大语言模型:它会自动检测你的 GPU/CPU/内存,并对能跑得动的 HuggingFace 模型进行排名,依据是真实测试成绩,而不是参数量。
它是命令行工具,还是有图形界面?纯命令行工具:一条命令就能输出一个排名表,包含内存占用、预估速度、适配类型和发布日期。没有 TUI 界面 —— 可以通过 --json | jq 编写脚本,--markdown 则会输出可直接粘贴的 GFM 表格。
怎么把它跑起来?需要 Python 3.11+,然后不用任何项目配置,直接运行一次推荐命令就行 —— 偶尔用的话运行 'uvx whichllm@latest' 即可,经常用的话建议正式安装。
它只推荐能完整装进显存的模型吗?默认设置比较激进 —— 排名里也会包含需要部分内存分担(offload)以及显存刚好够用的方案,只要看起来能跑。想选一个能完整装进显存、跑得从容的模型,用 --gpu-only 或 --fit full-gpu;如果还是觉得太紧张,再加 --vram-headroom。
它只认一份固定的模型清单,还是会跟上新发布的模型?数据是实时获取的:模型列表直接从 HuggingFace API 拉取并缓存到本地(模型 6 小时、测试成绩 24 小时),离线或被限流时会使用内置的精选离线数据兜底。
必须要 NVIDIA 显卡吗,还是 AMD、Intel、Mac 和纯 CPU 的电脑也能用?不一定要 NVIDIA。它能自动识别 NVIDIA、AMD、Intel、Apple Silicon 和纯 CPU 环境;NVIDIA 检测默认通过 nvidia-ml-py 实现,AMD 和 Apple Silicon 则会被自动识别。
它是怎么决定哪个模型排第一的?它综合了多份真实测试成绩 —— LiveBench、Artificial Analysis、Aider、一个视觉能力指数、Chatbot Arena ELO、Open LLM Leaderboard —— 并按来源可信度加权,同时会下调同一模型谱系里过时的分数,所以一个 2024 年的模型不可能靠过时的数据排在当前模型前面。每个分数都会标注等级 direct/variant/base/interpolated/self-reported 并相应打折;上传者虚构的成绩会被主动剔除。
它能帮我下载并运行模型,而不只是推荐吗?可以 —— 'whichllm run' 会创建一个隔离的 uv 环境,下载模型并启动交互式对话:GGUF 走 llama-cpp-python,AWQ/GPTQ 和 FP16/BF16 走 transformers。'whichllm snippet' 则会为任意模型输出一段可以直接运行的 Python 代码。
买显卡之前,能先查查它跑得动什么模型吗?可以 —— 用 'whichllm --gpu RTX 4090' 就能在购买前模拟任意显卡;多卡配置可以通过重复参数、逗号分隔或 '2x RTX 4090' 这样的写法来指定。反查命令 'whichllm plan llama 3 70b' 则能告诉你某个模型需要什么硬件。
它显示的 tok/s(每秒生成 token 数)是实测数据吗?不是 —— 那是根据显存带宽、量化方式、后端、适配类型以及 MoE 激活参数与总参数的比例估算出来的,以预估区间呈现,并带有置信标记(~ 或 ?)和颜色区分:低于 4 tok/s 红色,4-10 黄色,10-30 绿色,30 以上亮绿色。
作者
Andyyyy64
大小
10.5 MB
星标
6.9K
时长
8个月
提交 · 90 天