LLM Benchmarking and Self-Optimization: An Integrated Skill for API Evaluation and Parameter Tuning

Preface

After integrating a new LLM API or switching models, teams often have to write separate scripts to test latency, run stress tests, compare historical results, and manually adjust max_tokens and temperature. These steps are scattered, results are hard to align, and it is inconvenient to share reports with colleagues.

Below is an introduction to the community Skill on SkillHub: “Large Model Benchmarking and Self-Optimization” (Coordinates: @user_fcba917f/llm-benchmark). It integrates benchmarking, stress testing, historical analysis, parameter recommendation, and grid search tuning into a set of Agent workflows based on SKILL.md, and can generate HTML/PDF reports via llm_bench.py.

What is this

Positioning: A one-stop LLM API benchmarking and self-optimization tool for OpenAI-compatible endpoints.

Maintainer: SkillHub community publisher user_fcba917f (Page author listed as EFU周博远), sourced from the community, categorized under ai-agent. Current SkillHub version is 1.0.1 (The package documentation also lists the suite name as LLM Benchmark Suite v3.1).

Problem Solved: Completing quick/full benchmarks, continuous stress testing, multi-model comparison, historical trends, and parameter optimization under a unified command-line entry, reducing the cost of self-developed evaluation scripts.

The SkillHub tag includes requires_api_key=true. Actual evaluation requires a valid API address and key (For local scenarios like Ollama, a placeholder key can be used as per the Skill instructions).

Core Features

The following capabilities are derived from the official description and the SKILL.md within the package. They can be selected as needed:

  1. Quick Benchmark: Approximately 12 requests/round × N rounds, suitable for verifying connectivity first (--mode quick).
  2. Full Benchmark: Approximately 40 requests/round × N rounds, covering dimensions such as short text, math, creative writing, Q&A, code, reasoning, long text, and multilingual tasks.
  3. Continuous Stress Test: Supports specifying duration and concurrency, featuring checkpoint resumption, savepoints, and status querying (stress, status).
  4. Batch Comparison: Executes batch or batch-stress for multiple models.
  5. History & Optimization: optimize analyze for trends and performance profiling; optimize compare for horizontal comparison; optimize suggest for parameter recommendations based on production/development/loadtest scenarios; optimize auto-tune for grid search tuning.
  6. Reporting: The report subcommand outputs HTML, PDF, or both; optimization analysis can generate optimize_*.html.
  7. Metrics: TTFT, TPS, ITL, and P50/P90/P99, etc.; scoring supports objectives like tps, ttft, balance, etc.

Default results are written to benchmark_logs/ under the Skill directory. The path can be customized via the environment variable LLM_BENCH_LOG_DIR.

Installation and Activation

1. Install SkillHub CLI (if not already installed)

First, check if the CLI is available:

command -v skillhub && skillhub --version

If not installed, follow the SkillHub installation documentation (Full installation example):

curl -fsSL https://skillhub-1388575217.cos.ap-guangzhou.myqcloud.com/install/install.sh | bash

Documentation: https://skillhub.cn/install/skillhub.md

2. Install the Skill to the current Agent’s skills directory

During installation, you must use --dir to point to the skills directory recognized by the current client; otherwise, it defaults to ./skills/ and may not be loaded by the Agent. Common paths (subject to installation documentation):

  • Cursor: ~/.cursor/skills/
  • Claude Code: ~/.claude/skills/
  • Codex: ~/.codex/skills/ or .agents/skills/ under the project

Command to install this Skill (Namespace format provided by SkillHub search results):

skillhub install llm-benchmark --namespace user_fcba917f --dir ~/.cursor/skills/

You can also ask the Agent in the conversation to install @user_fcba917f/llm-benchmark following https://skillhub.cn/install/skillhub.md.

3. Python Dependencies

Before running the evaluation for the first time, install dependencies in the Skill directory (SKILL.md requires Python >= 3.9):

pip install httpx reportlab

For WorkBuddy / ClawHub scenarios, the documentation indicates you can search for llm-benchmark to install, and the environment will handle dependencies; for other clients, manual pip installation is standard.

Typical Usage

After the Agent triggers this Skill, it should execute python llm_bench.py <subcommand> in the Skill directory. If the user has not provided the API, key, or model name, the Agent should confirm them first; the API must be OpenAI-compatible (/v1/chat/completions format).

Quick Benchmark (Local Ollama Example):

python llm_bench.py benchmark \
  --api "http://localhost:11434/v1/chat/completions" \
  --key "ollama" \
  --model "qwen2.5:7b"

Full Benchmark:

python llm_bench.py benchmark --api "URL" --key "KEY" --model "MODEL" --mode full --rounds 3

One-hour Stress Test (3 concurrent requests, 256 max tokens):

python llm_bench.py stress --api "URL" --key "KEY" --model "MODEL" \
  --duration 60 --concurrency 3 --max-tokens 256

Check Task Progress:

python llm_bench.py status

Export Report:

python llm_bench.py report --file result.json --format both

Parameter Recommendation for Production Scenarios:

python llm_bench.py optimize suggest --model "qwen2.5:7b" --scenario production

Automatic Grid Tuning (Sends a large number of requests; duration and cost must be explained beforehand):

python llm_bench.py optimize auto-tune \
  --api "http://localhost:11434/v1/chat/completions" \
  --key "ollama" \
  --model "qwen2.5:7b" \
  --param max_tokens:64,128,256,512 \
  --param temperature:0.0,0.3,0.7,1.0 \
  --metric balance --goal maximize --top 5

Through the steps above, the Agent can extract TPS, TTFT, success rates, and trends from the output JSON and reports, and provide conclusions in natural language. When visualization is needed, call report or use the HTML generated by optimization analysis.

Applicable Scenarios and Notes

Target Users

  • Developers who need to compare multiple models or different parameter configurations of the same model within a unified workflow.
  • Teams already using clients that support Skills (such as Cursor, Claude Code, Codex) and wish to trigger “run benchmark / stress test / generate report” via natural language.
  • Scenarios integrating self-built or third-party OpenAI-compatible gateways that require historical trends and scenario-based parameter suggestions.

Limitations and Notes

  • A valid API must be provided; stress testing and auto-tune generate a large volume of requests. It is recommended to verify connectivity with --mode quick before running long tasks.
  • The SkillHub page shows approximately 630 downloads and a rating of 100000 (Statistics are subject to SkillHub and may change over time).
  • Interfaces using non-OpenAI compatible protocols or requiring login access are not covered by the Skill’s default assumptions.
  • If the Agent does not load the new Skill after installation, ensure the --dir path is correct and refresh or restart as required by the client.

Conclusion

“Large Model Benchmarking and Self-Optimization” consolidates LLM API evaluation, stress testing, historical analysis, and parameter tuning into the llm_bench.py script and the Agent-readable SKILL.md workflow, making it suitable as a standard checklist step after integrating new models.

Official Skill Address: https://api.skillhub.cn/user_fcba917f/llm-benchmark
SkillHub Page: https://www.skillhub.cn/skills/user_fcba917f/llm-benchmark

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye