[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-115336":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":16,"stars7d":17,"stars30d":17,"stars90d":15,"forks30d":15,"starsTrendScore":18,"compositeScore":19,"rankGlobal":9,"rankLanguage":9,"license":20,"archived":21,"fork":21,"defaultBranch":22,"hasWiki":23,"hasPages":21,"topics":24,"createdAt":9,"pushedAt":31,"updatedAt":32,"readmeContent":33,"aiSummary":34,"trendingCount":15,"starSnapshotCount":15,"syncStatus":14,"lastSyncTime":35,"discoverSource":36},115336,"inference-optimisation-skill","sybil-solutions\u002Finference-optimisation-skill","sybil-solutions","Agent skill for hill-climbing local LLM serving speed (decode, speculative decoding, prefill, KV, startup, TTFT) on any hardware and quantization",null,"Python",2368,222,8,2,0,189,1390,1151,108.89,"MIT License",false,"main",true,[25,26,27,28,29,30],"agent-skill","benchmarking","claude-code","inference","llm","speculative-decoding","2026-11-16 18:40:08","2026-11-23 20:48:22","# inference-optimisation\n\nAn agent skill for **hill-climbing the speed of a local LLM server** on any hardware and any quantization. It covers:\n\n- single-user and concurrent decode\n- speculative decoding\n- prefill\n- KV cache size\n- startup time and time to first token\n\nIt works under a memory cap, and every result has to survive a full-context stability check.\n\nIt encodes how we actually got these speedups. It is not a list of flags. The workflow:\n\n1. Compute the theoretical ceiling.\n2. Change one thing at a time.\n3. Measure against interleaved controls.\n4. Log every result, including the failures.\n5. Gate on long-context retrieval.\n6. Qualify a clean, pinned build before publishing.\n\nIt works with Claude Code and any agent that loads `SKILL.md`-style skills. Any model can also follow it from [`PROMPT.md`](PROMPT.md).\n\n## What we've been able to accomplish\n\nResults from the hill-climbs this skill was distilled from. Every number was measured on the hardware named; see the linked sources for methods and raw data.\n\n| Hardware | Model \u002F quant \u002F engine | Before → after |\n|---|---|---|\n| **Intel Arc B390 iGPU** (laptop, 64 GB unified LPDDR5X, ~115 GB\u002Fs) | Ornith-1.5-35B-A3B, EXL3 4 bpw, SGLang XPU + MTP | Decode, 1 user: 43.6 → **53 tok\u002Fs** (median)\u003Cbr>Decode, 4 users: 84.7 → **103 tok\u002Fs**\u003Cbr>Prefill 32K: 1,037 → **1,660 tok\u002Fs**\u003Cbr>Prefill 256K: 297 → **628 tok\u002Fs** (2.1×)\u003Cbr>KV cache: 264K tokens → **4 × 256K**\u003Cbr>Startup: 113 → **43 s**\u003Cbr>Registry Lab gates: decode 28.6 → **41.0**, prefill 255 → **667** |\n| **Intel Arc Pro B70** | Qwen3.8-27B, EXL3 4 bpw, vLLM + custom XPU kernels | Decode: **91.2 tok\u002Fs** at 1 user, **365** at 16 (prose, thinking on)\u003Cbr>Same card with llama.cpp Q4_K_M: 25.0\u003Cbr>Prefill 4K\u002F32K\u002F128K\u002F254K: 1,654\u002F1,434\u002F928\u002F650 → **2,421\u002F2,259\u002F1,415\u002F911**\u003Cbr>Agent-session replay: 193 → **147 s** |\n| **Intel Arc Pro B70** | Same model, SGLang + the same kernels | Decode, 1 user: **82.6 tok\u002Fs**, vs vLLM 75.7 on the same card and day |\n| **RTX 3090** | Qwen3.8-27B EXL3 3 bpw + MTP | **96.2 tok\u002Fs** prose \u002F **141.1** code, 1 user |\n| **RTX 3090** | Qwen3.6-35B-A3B EXL3 3 bpw + MTP | **251.7 \u002F 357.9 tok\u002Fs**, 1 user |\n| **RTX 3090** | Flash-Next EXL3, 256K context | MTP: 45.5 → **65.6 tok\u002Fs** |\n| **4× H200 NVL** | DeepSeek-V4.1-Flash, vLLM + speculative decoding | Crashed under load → **229.1 tok\u002Fs** decode, **17,546 tok\u002Fs** prefill; all six gates pass |\n\nSources:\n\n- [local-ai-registry](https:\u002F\u002Fgithub.com\u002Fsybil-solutions\u002Flocal-ai-registry):\n  - [Ornith B390 recipe](https:\u002F\u002Fgithub.com\u002Fsybil-solutions\u002Flocal-ai-registry\u002Ftree\u002Fmain\u002Fdata\u002Fsources\u002Fornith-b390-exl3), with the full hill-climb log in [PR #453](https:\u002F\u002Fgithub.com\u002Fsybil-solutions\u002Flocal-ai-registry\u002Fpull\u002F453)\n  - the RTX 3090 and H200 recipes\n- [trellis-serve](https:\u002F\u002Fgithub.com\u002Fsybil-solutions\u002Ftrellis-serve):\n  - `xpu\u002FREADME.md`, `xpu\u002Fdocs\u002FPROGRESS.md` and `xpu\u002Fdocs\u002FSGLANG.md` for B70\n  - `cuda\u002FREADME.md` for the RTX 3090\n- [qwen-serve](https:\u002F\u002Fgithub.com\u002Fsybil-solutions\u002Fqwen-serve)\n\n### Reading the B390 result\n\nThat run is the one this skill grew out of. Its ceiling calculation said:\n\n- **Decode:** 100 tok\u002Fs for one user was only reachable with two useful speculative drafts. This model's draft head accepts ~14% at depth 2, so the practical target was ~88–97 tok\u002Fs. We reached ~55% of it; the rest is GEMV kernel efficiency.\n- **Prefill at 256K:** we reached 628 tok\u002Fs against a ~670–684 tok\u002Fs ceiling.\n\nThe skill makes the agent compute this up front, so it can tell you early when a target is above the physics.\n\n## How it works\n\n```\n                ┌────────────────────────────────────────────────────────────────┐\n  measure HW ─▶ │ THEORY.md: bytes\u002Ftoken ÷ bandwidth, FLOPs\u002Ftoken ÷ 50% peak, KV │\n                └────────────────────────────────────────────────────────────────┘\n                                         │\n    baseline ─▶ profile ─▶ pick lever (ceiling gap × likelihood) ─▶ configs\u002FNEW.json\n                    ▲                                                     │\n                    │                                    queue.sh ctl NEW ctl (serialized, AC-only,\n                    │                                    memory watchdog, ≥6 samples, medians)\n                    │                                                     │\n   PLAN.md + ledger.jsonl ◀── accept only if it beats BOTH neighbouring controls ──┘\n          │                    and regresses nothing by >3%\n          ▼\n  long-context needle gate ─▶ concurrent full-KV soak ─▶ plateau? ─▶ pinned clean build\n                                                                      ─▶ acceptance gates ─▶ publish\n```\n\nThe skill has three parts:\n\n**[`SKILL.md`](skills\u002Finference-optimisation\u002FSKILL.md): the procedure.**\n- Inventory, ceilings, ground rules, the loop and lever order.\n- When to stop, how to qualify and publish, and how to report.\n\n**[`references\u002F`](skills\u002Finference-optimisation\u002Freferences): loaded only when needed.**\n- [`ceilings.md`](skills\u002Finference-optimisation\u002Freferences\u002Fceilings.md): how to compute decode, prefill, TTFT, startup and KV maxima, with a worked example.\n- [`methodology.md`](skills\u002Finference-optimisation\u002Freferences\u002Fmethodology.md): measurement traps. Chunk-counted tokens, mis-sized prompts, acceptance counters, drift, unified-memory accounting.\n- [`levers.md`](skills\u002Finference-optimisation\u002Freferences\u002Flevers.md): every lever with measured evidence. It is tagged general vs stack-specific.\n- [`gotchas.md`](skills\u002Finference-optimisation\u002Freferences\u002Fgotchas.md): known traps in vLLM, SGLang, llama.cpp and ExLlama, and on Intel, NVIDIA, Apple and AMD hardware.\n- [`publishing.md`](skills\u002Finference-optimisation\u002Freferences\u002Fpublishing.md): pinning, clean builds, the six acceptance gates, proving the build matches the best, results cards.\n\n**[`scripts\u002F`](skills\u002Finference-optimisation\u002Fscripts): a small, engine-agnostic harness.** It is standard-library Python plus bash.\n- `bench.py` benchmarks any OpenAI-compatible server. It measures:\n  - startup and short-prompt TTFT;\n  - c1 decode (median of N) and cN aggregate decode;\n  - cold prefill at several lengths;\n  - long-context needle retrieval;\n  - peak memory, with a cap watchdog.\n\n  It flags looping output, failed requests and runs on battery. Token counts come from server usage stats, never from streamed chunks, and everything lands in `ledger.jsonl`.\n- `ceiling.py` computes the theoretical ceilings from a JSON of measured bandwidth and FLOPs plus component sizes.\n- `queue.sh` is a serialized, detachable run queue, for interleaving control\u002Fcandidate\u002Fcontrol runs.\n- `mem.sh` reports a container's real footprint. That includes driver residency on unified-memory GPUs, which cgroups don't see.\n\n## Install\n\nClaude Code (user-level):\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fsybil-solutions\u002Finference-optimisation-skill\nmkdir -p ~\u002F.claude\u002Fskills\ncp -r inference-optimisation-skill\u002Fskills\u002Finference-optimisation ~\u002F.claude\u002Fskills\u002F\n```\n\nThen ask, for example:\n\n- \"hill-climb decode and prefill for the model on :8000 under a 40 GiB cap\"\n- \"what's the theoretical max tok\u002Fs for this model on this machine?\"\n\nOther agents: point them at `skills\u002Finference-optimisation\u002FSKILL.md`, or paste [`PROMPT.md`](PROMPT.md) as the task prompt.\n\n## Quick start without an agent\n\n```bash\nS=skills\u002Finference-optimisation\npython3 $S\u002Fscripts\u002Fceiling.py $S\u002Fexamples\u002Fceiling-ornith-b390.json        # ceilings\nmkdir -p configs && cp $S\u002Fexamples\u002Fconfig-existing-server.json configs\u002Fbase.json   # edit base_url\u002Fmodel\npython3 $S\u002Fscripts\u002Fbench.py run configs\u002Fbase.json --long 131072            # one run\nbash $S\u002Fscripts\u002Fqueue.sh base cand base                                     # interleaved A\u002FB\npython3 $S\u002Fscripts\u002Fbench.py show                                            # ledger table\n```\n\n## Principles that carried the most weight\n\n- **Ceilings first.** If you don't know the maximum, you can't tell whether 53 tok\u002Fs is great or bad, or whether \"100 tok\u002Fs\" is possible.\n- **Noise is ±5–10%.** Most single-run \"wins\" are drift. Interleave controls and use medians.\n- **Measure what matters:**\n  - real tokens, not stream chunks;\n  - real prompt lengths, from the tokenizer;\n  - real memory, including GPU residency on unified memory.\n- **Speculative decoding is about per-step cost, not acceptance.**\n  - Prune the draft head's vocabulary.\n  - Sweep draft length per concurrency and context.\n  - Keep sampling on the GPU.\n- **Prove full-context stability** with exact-match needles and a concurrent full-KV soak before calling anything \"best\".\n- **Write down failures.** Most of the value in `PLAN.md` is the list of things that did *not* work and why.\n\n## Contributing\n\nPRs with new levers, gotchas or results are welcome. Each needs the hardware, model, quantization, engine version, before → after numbers, how they were measured, and a link to raw data.\n\n## License\n\nMIT\n","这是一个面向本地大语言模型（LLM）服务性能优化的智能体技能，通过系统性爬山调优（hill-climbing）方法，在任意硬件和量化配置下提升推理关键指标：解码吞吐量（decode）、推测解码（speculative decoding）、Prefill速度、KV缓存容量、启动时间及首token延迟（TTFT）。其核心特点是基于实证驱动的工作流——理论建模→单变量调优→交叉对照测量→全上下文稳定性验证→构建可复现的固化版本。适用于边缘设备、消费级显卡及数据中心级GPU上的低延迟、高并发LLM本地部署场景。","2026-11-24 04:50:43","CREATED_QUERY"]