agentleFS
asmamestasmamest/Nexus-Skills/skills/ai-engineering/model-serving-inference/SKILL.md

model-serving-inference

Skill1 starsChanged 17 days agoMITView on GitHub

Design efficient and reliable LLM inference or model-serving systems, including batching, streaming, quantization, caching, capacity planning, and failure handling.

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 4 are distinctive, and 0 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.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Preserve quality: Run task-level and safety evaluations after changing precision, model version, tokenizer, sampling, or serving …

    line 16
  2. Distinctive:

    Handle failures: Use bounded retries with jitter for transient failures, idempotency for retried actions, and carefully evaluated fallbacks.

    line 18
  3. Distinctive:

    Roll out gradually: Use canary traffic, shadow comparisons where safe, health checks, rollback criteria, and pinned model/runtime versions.

    line 19
  4. Distinctive:

    Document workload assumptions, benchmark methodology, runtime/model versions, capacity limits, rollout/rollback plan, quality impact, and …

    line 36

≈ “Common” is an estimate: at least 1 in 5 of the 308,232 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Model Serving and Inference

Goal

Serve models against explicit quality, throughput, latency, availability, privacy, and cost requirements. Optimize measured bottlenecks rather than assuming one serving stack fits every model.

Workflow

  1. Specify workload. Estimate request rates, prompt/output token distributions, concurrency, context lengths, streaming needs, SLA, model size, and hardware constraints.
  2. Establish baseline. Measure time to first token, inter-token latency, end-to-end p50/p95/p99, throughput, GPU/CPU/memory utilization, error rate, and cost per successful request.
  3. Select deployment mode. Compare hosted APIs, dedicated endpoints, self-hosted runtimes, and edge/local inference based on control, scale, data residency, and operational capacity.
  4. Tune safely. Evaluate batching, continuous batching, KV-cache behavior, quantization, speculative decoding, prefix caching, and request limits against representative prompts and outputs.
  5. Preserve quality. Run task-level and safety evaluations after changing precision, model version, tokenizer, sampling, or serving configuration.
  6. Protect capacity. Set concurrency limits, queue bounds, timeouts, cancellation, backpressure, and rate limits. Return useful overload errors instead of unbounded queuing.
  7. Handle failures. Use bounded retries with jitter for transient failures, idempotency for retried actions, and carefully evaluated fallbacks. Do not retry permanent invalid requests indefinitely.
  8. Roll out gradually. Use canary traffic, shadow comparisons where safe, health checks, rollback criteria, and pinned model/runtime versions.
  9. Monitor drift and cost. Watch latency, throughput, token distribution, quality, hardware saturation, and provider changes.

Performance dimensions

  • Time to first token (TTFT) and inter-token latency for streaming.
  • End-to-end latency and successful tasks per second.
  • Tokens per second and cost per successful task.
  • Memory headroom, queue time, cache hit rate, and failure/retry rates.

Avoid

  • Reporting throughput without concurrency and workload details.
  • Comparing systems with different prompt/output lengths or quality targets.
  • Enabling cache reuse across users or tenants when context isolation cannot be guaranteed.
  • Using quantization or caching without regression tests and security review.
  • Treating a healthy process as proof the model endpoint is serving correct results.

Deliverable

Document workload assumptions, benchmark methodology, runtime/model versions, capacity limits, rollout/rollback plan, quality impact, and operating metrics.

References

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.