[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-111319":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":13,"contributorsCount":13,"subscribersCount":13,"size":13,"stars1d":15,"stars7d":16,"stars30d":17,"stars90d":13,"forks30d":13,"starsTrendScore":18,"compositeScore":19,"rankGlobal":10,"rankLanguage":10,"license":20,"archived":21,"fork":21,"defaultBranch":22,"hasWiki":21,"hasPages":23,"topics":24,"createdAt":10,"pushedAt":45,"updatedAt":46,"readmeContent":47,"aiSummary":48,"trendingCount":13,"starSnapshotCount":13,"syncStatus":15,"lastSyncTime":49,"discoverSource":50},111319,"local-llm-tuning-guide","Lowaltitudeflight\u002Flocal-llm-tuning-guide","Lowaltitudeflight","A decision library for running local LLMs on multi-GPU machines without NVLink: parallelism, communication, quantization, speculative decoding, KV cache. Every conclusion carries its evidence grade and reproducible conditions.","https:\u002F\u002Flowaltitudeflight.github.io\u002Flocal-llm-tuning-guide\u002F",null,"Python",82,0,57,2,16,64,6,58.4,"MIT License",false,"main",true,[25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44],"benchmarking","decision-guide","gpu-serving","inference-optimization","kv-cache","llm","llm-deployment","llmops","local-llm","model-parallelism","multi-gpu","nvidia","nvlink","pcie","performance-tuning","quantization","self-hosted","speculative-decoding","tensor-parallelism","vllm","2026-11-12 06:00:43","2026-11-22 04:29:32","**English** ｜ [简体中文](README.zh-CN.md)\n\n[![CI](https:\u002F\u002Fgithub.com\u002FLowaltitudeflight\u002Flocal-llm-tuning-guide\u002Factions\u002Fworkflows\u002Fci.yml\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002FLowaltitudeflight\u002Flocal-llm-tuning-guide\u002Factions\u002Fworkflows\u002Fci.yml)\n[![License: MIT](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Flicense-MIT-blue.svg)](LICENSE)\n[![Release](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fv\u002Frelease\u002FLowaltitudeflight\u002Flocal-llm-tuning-guide?sort=semver)](https:\u002F\u002Fgithub.com\u002FLowaltitudeflight\u002Flocal-llm-tuning-guide\u002Freleases)\n\n# Local LLM Tuning Guide\n\n**Decisions, not theory, for multi-GPU LLM serving on PCIe machines without NVLink.**\nEvery claim carries an evidence grade and the conditions under which it holds.\n\n![DeepSeek-V4.1-Flash on 8x RTX PRO 5000 72GB: output throughput against concurrency for short and long requests, with the reproducible c8 dip annotated](docs\u002Fimages\u002Fsocial-preview.png)\n\n| What you get | Detail |\n| --- | --- |\n| **Measured, not repeated** | 8 datasets, three independent launches each, per-configuration variance |\n| **Failures included** | [9 failed configurations](docs\u002F09-failures.md) — what never starts, and what runs but misleads |\n| **Numbers you can check** | every KV figure re-derived in CI; every dataset declares its [reproducibility status](benchmarks\u002FREADME.md#reproducibility-status-of-every-dataset) |\n| **Bilingual** | every chapter and recipe in English and 简体中文 |\n\nThree findings that did not match the folklore:\n\n- **TP8 used 2× the cards for +12% throughput** — per GPU, TP4 was 1.7× better.\n- **A 476 GiB checkpoint cannot run TP4 on 4×72 GB** — it OOMs at 70.74 GiB, 48 GiB short per card.\n- **KV cache measured 785 B\u002Ftoken**, 30× smaller than the GQA formula predicts for this model.\n\n---\n\n## Why this exists\n\nMost self-hosted inference today runs on machines **without NVLink**: RTX 4090 \u002F 5090, RTX PRO 6000, PCIe variants of datacenter cards, connected over PCIe 5.0 x16 or a PCIe switch.\n\nYet the documentation, tuning advice, and default configurations of mainstream inference frameworks are almost all written under the assumption that GPUs talk over a fast interconnect. The consequences:\n\n- The same four GPUs can differ by more than 2× in throughput (community reports; see [benchmarks](benchmarks\u002F)) — the difference is configuration, not silicon\n- Articles explaining the principles are easy to find, but **their parameter recommendations contradict each other and rarely state test conditions**\n- You cannot tell whether a piece of advice applies to your machine\n\nThis project supplies the missing half: **binding each conclusion to the conditions under which it is valid.**\n\n## Who this is for\n\n- You run 2–8 GPUs on one box, over PCIe, without NVLink.\n- You are choosing TP \u002F PP \u002F EP \u002F replicas, quantization, or KV settings and want a starting point with its evidence attached.\n- You have a benchmark number and need to know whether it transfers to your machine.\n\n**Not for**: multi-node fabrics (InfiniBand, NVSwitch), training, or “which model is smartest” rankings. The guide is about serving configuration, not model quality.\n\n## Start here\n\n1. Run `python tools\u002Fdetect_topology.py` and keep the JSON — it is the input to every later decision.\n2. Open the [model matrix](MODEL_MATRIX.md) to see whether your model fits, and on how many cards.\n3. Pick the closest [recipe](recipes\u002F), copy the flags, then measure with [bench\u002Frun_matrix.py](bench\u002Frun_matrix.py) instead of trusting the defaults.\n\n## Quick decision table\n\nSix highest-frequency questions, answered first.\n\n| Your situation | Recommendation | Basis |\n|---|---|---|\n| Model (plus KV) fits on one GPU | **Prefer replicas over tensor parallelism** | Measured + derivable |\n| Model must be split; all GPUs under one PCIe switch | **Start with TP = GPUs under that switch, then measure.** On the 8×72 box TP8 beat TP4-on-one-node by 12% aggregate — but it used **2× the cards**; TP4 was **1.7× better per GPU** | Measured |\n| GPUs span PCIe switches or CPU sockets | **Avoid letting TP cross that boundary by default** — use TP × PP or replicas. The same box measured one exception (TP8 across SYS still beat TP4-on-node); treat this as a default, not a law | Derivable + measured |\n| You want a longer context | Lower KV precision or add GPUs first; DCP gains little over PCIe | Measured + derivable |\n| You want speculative decoding for speed | **Longer drafts are not automatically better** — start at 2–3. The published 19–22% gap compares MTP3 with DFlash2-K7, which differ in draft method too | Measured (confounded) |\n| Quantization hurts output quality | **Raise activation precision first** — W4A4 → W4A16 took checksum failures from 5.9% to 0. FP32 router weights are a free second safeguard | Measured |\n\n## Contents\n\n| Chapter | Topic | In one line |\n|---|---|---|\n| [01 Hardware & topology](docs\u002F01-hardware.md) | The real gap between PCIe and NVLink | Find out how your GPUs are actually connected |\n| [02 Parallelism](docs\u002F02-parallelism.md) | TP \u002F PP \u002F DP \u002F EP \u002F DCP | When adding a GPU makes things slower |\n| [03 Communication](docs\u002F03-communication.md) | All-reduce modes and NCCL tuning | Why PCIe prefers one-shot |\n| [04 Quantization](docs\u002F04-quantization.md) | FP8 \u002F MXFP8 \u002F NVFP4 \u002F AWQ trade-offs | What you pay for the memory you save |\n| [05 Speculative decoding](docs\u002F05-speculative.md) | MTP \u002F DFlash \u002F EAGLE families | Why guessing more can be slower |\n| [06 KV cache](docs\u002F06-kv-cache.md) | Memory budget, prefix cache, long context | How context eats your VRAM |\n| [07 Troubleshooting](docs\u002F07-troubleshooting.md) | Symptom → cause → fix | OOM, bad output, SM120 kernel gaps, hung containers |\n| [08 Power & cost](docs\u002F08-power-cost.md) | Tokens per watt and per dollar | Why a 300 W card stops scaling |\n| [09 Failed configurations](docs\u002F09-failures.md) | What does not work, and why | The negative half of the library |\n| [Model matrix](MODEL_MATRIX.md) | What fits on 72 GB cards | Weights, KV\u002Ftoken, minimum GPU count, verified configs |\n| [Recipes](recipes\u002F) | Ready-to-use configs by hardware | [4×72](recipes\u002F4x-72gb-pcie.md) · [8×72](recipes\u002F8x-72gb-pcie.md) · [4×96](recipes\u002F4x-96gb-pcie.md) · [8×24](recipes\u002F8x-24gb-pcie.md) |\n| [Benchmarks](benchmarks\u002F) | Data tables and measurement method | Fill the table with your own machine |\n| [Planner](tools\u002F) | Hardware in, parallel strategy out | [CLI + offline web tool](tools\u002F) · [try the web tool online](https:\u002F\u002Flowaltitudeflight.github.io\u002Flocal-llm-tuning-guide\u002F) |\n| [Glossary](docs\u002FGLOSSARY.md) | Terms and abbreviations | TP \u002F PP \u002F EP \u002F MLA \u002F NVFP4 \u002F SM120 |\n| [Articles](articles\u002F) | Long-form write-ups | English abstracts + Chinese full text |\n\nEvery chapter is also available in [简体中文](docs\u002Fzh-CN\u002F) — as are the\n[recipes](recipes\u002Fzh-CN\u002F), the [benchmark pages](benchmarks\u002Fzh-CN\u002F), and\n[CONTRIBUTING](CONTRIBUTING.zh-CN.md).\n\n## Evidence grading\n\nEvery conclusion carries a basis tag:\n\n| Tag | Meaning |\n|---|---|\n| **Measured** | Produced by a run on real hardware. Hardware, software versions and variance are recorded; new submissions must also record clock policy, image digest and the exact server\u002Fclient commands (see [SCHEMA](benchmarks\u002Fdata\u002FSCHEMA.md)). Entries submitted before 2026-11 lack the last three and are marked as such — they were run, but are not yet fully reproducible |\n| **Derivable** | Calculated from a model config, hardware specification or framework mechanic; independent of any single measurement. In tables, a derivable figure says so (for example the KV\u002Ftoken derivation block in [MODEL_MATRIX](MODEL_MATRIX.md)) |\n| **Open** | Direction is clear but public data is missing; we provide a measurement method and leave the cell to be filled |\n\n**What this project does not do: invent numbers.** An empty cell is worth more than a fabricated one.\n\n## Key conclusions at a glance\n\nSix of the highest-confidence judgements, expanded in the chapters.\n\n1. **If it fits on one GPU, do not use tensor parallelism.** Two independent replicas have zero inter-GPU communication and scale throughput linearly; TP all-reduces at every layer, and over PCIe that cost eats most of the gain.\n2. **The boundary for TP is the PCIe switch, not the GPU count.** Traffic crossing switches goes through CPU memory with a sharp latency penalty. With four GPUs split across two switches, TP=4 is often worse than TP=2 × PP=2 — sometimes worse than two TP=2 replicas.\n3. **Over PCIe, prefer one-shot all-reduce.** The two-shot scheme is superior on a fast interconnect, but that superiority assumes ample bandwidth. PCIe is the opposite case.\n4. **Speculative decoding gains are bandwidth-bound.** A longer draft wastes more compute per failed verification, and the draft model itself consumes bandwidth. The published comparison (MTP3 vs DFlash2-K7) shows the shorter draft ahead by 19–22%, but the two configurations also differ in draft method and weights — read it as \"measure both\", not \"7 is always worse than 3\".\n5. **Raise activation precision before touching the router.** In MoE models, W4A4 → W4A16 alone took greedy-checksum failures from 5.9% to 0. Keeping FP32 router weights costs no measurable throughput and is the difference on pre-QAD checkpoints (19.5% → 4.0%), but it does not substitute for A16 activations.\n6. **On one machine, configuration alone accounts for more than a 2× throughput difference.** This is not folklore — every parameter is either aligned with your real topology or fighting it.\n\n## How to use this\n\n**Deploying a new machine**: start with [01 Hardware & topology](docs\u002F01-hardware.md), run `nvidia-smi topo -m` once, then find the closest match in [recipes](recipes\u002F).\n\n**Machine already running but slow**: run the planner and diff its parameters against your current ones.\n\n```bash\npython tools\u002Fplanner.py --gpus A800-80 --count 8 --model qwen2.5-72b --ctx 8192\n```\n\nIt reports the interconnect ceiling, the memory budget, and a TP \u002F PP \u002F replica\nlayout — each tagged with an evidence grade. See [tools\u002FREADME.md](tools\u002FREADME.md).\n\n**Want to contribute data**: see [CONTRIBUTING.md](CONTRIBUTING.md). The tables are ready; what is missing is measurements from real machines.\n\n## Related projects\n\n- [llm-inference-bench](https:\u002F\u002Fgithub.com\u002FLowaltitudeflight\u002Fllm-inference-bench) — the companion benchmarking platform that produces the data this project consumes\n- [llm-private-deploy-handbook](https:\u002F\u002Fgithub.com\u002FLowaltitudeflight\u002Fllm-private-deploy-handbook) — delivery process handbook for private deployments\n\n## License\n\n[MIT](LICENSE)\n","这是一个面向无NVLink多GPU服务器的本地大语言模型（LLM）推理调优决策指南。项目通过在PCIe互联的多卡环境（如RTX 4090\u002F5090、RTX PRO系列）中系统性实测，提供模型并行（TP）、KV缓存优化、量化、推测解码等关键配置的实证结论，并为每项建议标注证据等级与可复现条件（硬件型号、CUDA版本、框架配置等）。所有数据均基于8个基准测试集、每配置3次独立运行验证，并包含9种典型失败案例分析。适用于需在单机多GPU上高效部署开源LLM（如Llama、DeepSeek）的开发者、MLOps工程师及私有化AI平台运维人员。","2026-11-24 04:40:49","CREATED_QUERY"]