Find the Best AI Model for Any Task from Hugging Face
A skill for finding the best Hugging Face model for a task, ranked by official benchmarks and filtered by device fit.
Why it matters
Help developers and ML practitioners quickly identify the optimal pre-trained model for their specific use case by querying Hugging Face leaderboards, benchmarks, and model metadata, then recommending top candidates based on task requirements, hardware constraints, and performance scores.
Outcomes
What it gets done
Query Hugging Face leaderboards and benchmark databases to surface top-performing models for specific tasks
Filter and rank models based on hardware constraints, memory requirements, and deployment targets
Extract and compare benchmark scores across different evaluation metrics and datasets
Recommend the best model candidates with justification based on task type and performance criteria
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/ag-huggingface-best | bash Overview
HuggingFace Best Model Finder
This skill finds the best Hugging Face model for a task by querying official benchmark leaderboards, enriching with model size, filtering by device fit, and outputting a ranked comparison table. Use it when a user asks for the best or top model for a task, or wants to compare models by benchmark score.
What it does
A skill for finding the best Hugging Face model for a task by querying official HF benchmark leaderboards, enriching results with model size data, filtering for what fits the user's device, and returning a ranked comparison table. Step 1 parses the request for task (coding, math/reasoning, chat, OCR, RAG, speech recognition, image classification, multimodal, agents) and device (Apple Silicon unified memory, RTX VRAM, CPU-only, or no constraint) - if device isn't mentioned, size filtering is skipped entirely. Step 2 fetches the full list of official HF benchmark datasets via the datasets API filtered to benchmark:official and selects every dataset relevant to the task (not limited to 2-3 - use all that clearly apply). Step 3 fetches the top 15 ranked models from each selected benchmark's leaderboard, skipping and noting any leaderboard that 404s or 401s. Step 4 enriches the top 10-15 candidate model IDs with metadata via the models API or hf-cli, extracting parameter count from safetensors.total (converted to B) or parsed from the model name if safetensors metadata is absent, plus license from model-card tags. Step 5 filters and ranks: when a device is specified, models exceeding the fp16 parameter budget are removed unless they fit under Q4 quantization (roughly 4x the fp16 budget), in which case they're kept with a "needs Q4" note rather than silently dropped; models are then ranked by benchmark score and the top 5-8 kept, with proprietary models (GPT-4, Claude, Gemini) included but flagged "API only / not self-hostable" unless the user asked for local/open models only. The device-to-parameter-budget formula is fp16 max params (B) ~= memory (GB) / 2, Q4 max params (B) ~= memory (GB) x 2 - e.g. 16GB yields 8B fp16 / 32B Q4, 24GB VRAM yields 12B fp16 / 48B Q4. Step 6 outputs a markdown comparison table (model linked to its HF page, params, per-benchmark scores with "-" for unevaluated, license, and an "On device" column of Yes (fp16)/Q4 only/Too large/API only, starring the top pick), then asks whether the user wants to run the top model locally (with setup instructions) or via HF Jobs. Error handling covers a missing leaderboard (skip and note), a model missing metadata (parse size from its name), no benchmarks found for the task (fall back to hub_repo_search sorted by trendingScore), and all leaderboards failing (fall back to popularity-based search, disclosed as such).
When to use - and when NOT to
Use it when a user asks about finding the best, top, or recommended model for a task, wants to know what AI model to use, or wants to compare models by benchmark score - triggering on phrasing like "best model for X" or "which model runs on my [device]".
Inputs and outputs
Input is a task description and optionally a device/hardware constraint. Output is a ranked markdown comparison table of 5-8 models with benchmark scores, parameter count, license, and device-fit status, plus a follow-up offer to help run the top pick locally or via HF Jobs.
Integrations
curl -s -H "Authorization: Bearer $(cat ~/.cache/huggingface/token)" "https://huggingface.co/api/datasets?filter=benchmark:official&limit=500"
Uses the Hugging Face Hub's datasets API (official benchmarks and their leaderboards), models API or hf-cli for model metadata, and hub_repo_search as a popularity-based fallback when benchmark data is unavailable.
Who it's for
Developers and researchers choosing which Hugging Face model to use for a task, especially those with a specific device to fit the model on - getting a benchmark-ranked comparison instead of manually cross-referencing multiple leaderboards and model cards.
Source README
HuggingFace Best Model Finder
When to Use
Use when the user asks about finding the best, top, or recommended model for a task, wants to know what AI model to use, or wants to compare models by benchmark scores. Triggers on: "best model for X", "what model should I use for", "top models for [task]", "which model runs on my...
Finds the best models for a task by querying official HF benchmark leaderboards, enriching
results with model size data, filtering for what fits on the user's device, and returning a
comparison table with benchmark scores.
Step 1: Parse the request
Extract from the user's message:
- Task: what they want the model to do (coding, math/reasoning, chat, OCR, RAG/retrieval, speech recognition, image classification, multimodal, agents, etc.)
- Device: hardware constraints (MacBook M-series 8/16/32/64GB unified memory, RTX GPU with VRAM amount, CPU-only, cloud/no constraint, etc.)
If device is not mentioned, skip filtering entirely and return the highest-performing models regardless of size. If the task is genuinely ambiguous, ask one clarifying question.
Device → max parameter budget
When a device is specified, extract its available memory (unified RAM for Apple Silicon, VRAM for discrete GPUs) and apply:
- fp16 max params (B) ≈ memory (GB) ÷ 2
- Q4 max params (B) ≈ memory (GB) × 2
Examples: 16GB → 8B fp16 / 32B Q4 - 24GB VRAM → 12B fp16 / 48B Q4 - 8GB → 4B fp16 / 16B Q4
Step 2: Find relevant benchmark datasets
Fetch the full list of official HF benchmarks:
curl -s -H "Authorization: Bearer $(cat ~/.cache/huggingface/token)" \
"https://huggingface.co/api/datasets?filter=benchmark:official&limit=500" | jq '[.[] | {id, tags, description}]'
Read the returned list and select the datasets most relevant to the user's task - match on dataset id, tags, and description. Use your judgment; don't limit yourself to 2-3. Aim for comprehensive coverage: if 5 benchmarks clearly cover the task, use all 5.
Step 3: Fetch top models from leaderboards
For each selected benchmark dataset:
curl -s -H "Authorization: Bearer $(cat ~/.cache/huggingface/token)" \
"https://huggingface.co/api/datasets/<namespace>/<repo>/leaderboard" | jq '[.[:15] | .[] | {rank, modelId, value, verified}]'
Collect model IDs and scores across all benchmarks. If a leaderboard returns an error (404, 401, etc.), skip it and note it in the output.
Step 4: Enrich with model metadata
For the top 10-15 candidate model IDs, get model infos.
### REST API
curl -s -H "Authorization: Bearer $(cat ~/.cache/huggingface/token)" \
"https://huggingface.co/api/models/org/model1" | jq '{safetensors, tags, cardData}'
### CLI (hf-cli)
hf models info org/model1 --json | jq '{safetensors, tags, cardData}'
Extract from each response:
- Parameters:
safetensors.total→ convert to B (e.g., 7_241_748_480 → "7.2B") - License: from model card tags (look for
license:apache-2.0,license:mit, etc.) - If
safetensorsis absent, parse size from the model name (look for "7b", "8b", "13b", "70b", "72b", etc.)
Step 5: Filter and rank
If a device was specified:
- Remove models exceeding the fp16 parameter budget for the device
- Flag models that fit only with Q4 quantization (multiply budget by ~4 for Q4 capacity)
- If a highly-ranked model is slightly over budget, keep it with a "needs Q4" note - don't silently drop it
If no device was mentioned: skip all size filtering - just rank by benchmark score.
Then: rank by benchmark score (descending), keep top 5-8 models.
Include proprietary models (GPT-4, Claude, Gemini) if they appear on leaderboards, but flag them as "API only / not self-hostable". If the user explicitly asked for local/open models only, exclude them.
Step 6: Output
Comparison table
| # | Model | Params | [Benchmark 1] | [Benchmark 2] | License | On device |
|---|-------|--------|--------------|--------------|---------|-----------|
| ⭐1 | [org/name](https://huggingface.co/org/name) | 7B | 85.2% | — | Apache 2.0 | Yes (fp16) |
| 2 | [org/name](https://huggingface.co/org/name) | 13B | 83.1% | 71.5% | MIT | Q4 only |
| 3 | [org/name](https://huggingface.co/org/name) | 70B | 90.0% | 81.0% | Llama | Too large |
- Link model names to
https://huggingface.co/<model_id> - Use
—for benchmarks where the model wasn't evaluated - Star the top recommended pick with ⭐
- "On device" values:
Yes (fp16),Q4 only,Too large,API only
Follow-up
After presenting the table, ask the user: "Would you like to run [top recommended model]?"
If they say yes, ask whether they'd prefer to:
- Run locally - ask about their device if not already known, then give appropriate setup instructions
- Run on HF Jobs - point them to the HF Jobs guide: https://huggingface.co/docs/huggingface_hub/en/guides/jobs
Error handling
- Leaderboard not found: skip, note "leaderboard unavailable" in output
- Model missing from hub_repo_details: fall back to parsing size from model name
- No benchmarks found for task: use the curated fallback table above, or try
hub_repo_searchwithfilters=["<task>"]sorted bytrendingScore - All leaderboards fail: fall back to
hub_repo_searchfor popular models tagged with the task, note that results are by popularity rather than benchmark score
Limitations
- Use this skill only when the task clearly matches its upstream product or API scope.
- Verify commands, API behavior, pricing, quotas, credentials, and deployment effects against current official documentation before making changes.
- Do not treat generated examples as a substitute for environment-specific tests, security review, or user approval for destructive or costly actions.
FAQ
Common questions
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.