inference-optimization
Skill0 starsChanged 47 days agoMITView on GitHub
Use when tuning inference efficiency on given hardware — GPU/VRAM sizing, quantization (GGUF/AWQ/GPTQ/FP8), KV-cache, batching, speculative decoding, attention optimizations (e.g. FlashAttention), latency/throughput trade-offs. Do NOT use for choosing a serving stack or topology (see skill model-serving) or the model itself (see skill model-selection-hf).
In this repository25 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- google-ads-managementSkill
- meta-ads-managementSkill
- tiktok-ads-managementSkill
- ai-automationSkill
- ai-researchSkill
- ai-system-designSkill
- context-engineeringSkill
- eval-harnessSkill
- implementation-verificationSkill
- model-selection-hfSkill
- model-servingSkill
- production-opsSkill
- rag-engineeringSkill
- tool-and-mcp-designSkill
- training-data-engineeringSkill
- training-peftSkill
- jev-browserSkill
- premiere-pro-mcpSkill
- suno-music-generatorSkill
- growth-loopSkill
- mobile-store-releaseSkill
- mobile-ui-reviewSkill
- store-listing-assetsSkill
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 4 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 13
Treat estimates as capacity hypotheses and measurements as evidence.
- Very specific: line 24
Read the quantization decision tree.
- Very specific: line 32
Test speculative decoding only after verifying draft/target/runtime compatibility.
- Distinctive: line 33
Test attention optimizations only after verifying model shape, dtype, accelerator, runtime, and kernel support.
- Distinctive: line 35
When two benchmarks conflict, compare workload, hardware, precision, versions, concurrency, warmup, quality gate, and measurement method.
- Very specific: line 45
If runtime or hardware inspection is unavailable, provide ranges and formulas labeled ESTIMATE.
- Distinctive: line 46
If benchmarking is unavailable, return an experiment plan and conditional ranking only.
- Very specific: line 47
If quality evaluation is unavailable, do not approve quantization or decoding changes for production.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Inference Optimization
Boundaries
- Optimize an already identified model and workload on specified hardware and runtime constraints.
- For concrete model selection and license verification, see skill model-selection-hf.
- For serving engine, endpoint topology, scaling, and multi-region design, see skill model-serving; return measured runtime requirements as inputs.
- Treat estimates as capacity hypotheses and measurements as evidence. Never claim that a model fits or an optimization helps until the complete envelope is accounted for and tested.
Decision Workflow
- Pin the model revision and architecture, parameter count, precision/artifact, runtime version, accelerator and memory, prompt/output length distributions, context ceiling, concurrency, quality floor, and latency/throughput objectives.
- For current hardware, kernel, runtime, format, speculative-decoding, and attention-feature compatibility, see skill ai-research. Mark unsupported or unverified combinations before ranking them.
- Build a memory envelope:
- estimate weights from the exact artifact or
parameters × effective bytes, including quantization metadata; - calculate KV cache from the model architecture, cache dtype, sequence length, batch/concurrency, and runtime layout;
- include activations, temporary workspaces, graph/kernel buffers, allocator fragmentation, runtime/process overhead, and a safety margin;
- show every assumption, unit, and range. Never use weights alone as a fit test.
- estimate weights from the exact artifact or
- Read the quantization decision tree. Eliminate formats without verified hardware/runtime/model support, then compare memory, quality, conversion, portability, and kernel implications.
- Locate the bottleneck with separate prefill and decode measurements. Treat batching, cache policy, speculative decoding, prefix reuse, attention kernels, and compilation as independent hypotheses with interactions to test.
- Define a reproducible benchmark gate: pin versions and settings; use representative prompt/output buckets and concurrency; warm up; repeat runs; capture raw results; and compare against the same quality set.
- Measure time to first token, inter-token/decode latency, end-to-end p50/p95/p99 latency, tokens per second, request throughput, peak and steady memory, queueing, error rate, and task quality.
- Select only a configuration that meets the predeclared memory, quality, latency, and throughput gates. Report uncertainty, conflicting benchmarks, and rollback conditions.
Speculative and attention decision notes
- Test speculative decoding only after verifying draft/target/runtime compatibility. Measure acceptance rate, draft cost, tail latency, memory, and quality; do not assume a universal speedup.
- Test attention optimizations only after verifying model shape, dtype, accelerator, runtime, and kernel support. Compare full workload behavior, not a microbenchmark alone.
- Separate improvements to prefill from improvements to decode. Do not attribute queueing or batching changes to a kernel without controlled evidence.
- When two benchmarks conflict, compare workload, hardware, precision, versions, concurrency, warmup, quality gate, and measurement method. Run a workload-matched reproduction instead of choosing the more favorable result.
Required Output
Return the pinned input contract, transparent memory worksheet, supported candidate configurations, benchmark protocol, raw-result locations, comparison table, selected configuration, confidence, and remaining UNVERIFIED claims.
Tool Requirements & Degradation
- Require artifact/config inspection, hardware and runtime inventory, memory telemetry, a repeatable load/benchmark runner, and a workload quality check.
- For current format, kernel, runtime, hardware, and feature support, see skill ai-research. Do not infer compatibility from a format name.
- If runtime or hardware inspection is unavailable, provide ranges and formulas labeled
ESTIMATE; do not state that the model fits. - If benchmarking is unavailable, return an experiment plan and conditional ranking only. Do not convert published benchmarks into local measurements.
- If quality evaluation is unavailable, do not approve quantization or decoding changes for production; label the quality effect
UNVERIFIED.
Failure Modes
- Calculating only weight memory and omitting KV cache, concurrency, workspaces, overhead, fragmentation, or margin.
- Assuming GGUF, AWQ, GPTQ, and FP8 are interchangeable or supported by every runtime and accelerator.
- Reporting estimates as observed measurements or promising universal latency gains.
- Comparing benchmarks with mismatched workload, version, hardware, precision, or quality gates.
- Optimizing average latency while ignoring time to first token, tail latency, queueing, memory, or output quality.
- Choosing a different model, serving engine, or deployment topology to make the tuning result look successful.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

