Skip to content

Studio: classify MLX repos by name or model-card tag everywhere - #16883

Merged
NilayYadav merged 2 commits into
unslothai:mainfrom
Lyxot:mlx-format-classifier
Nov 6, 2026
Merged

NilayYadav merged 2 commits into
unslothai:mainfrom
Lyxot:mlx-format-classifier

Conversation

@Lyxot

@Lyxot Lyxot commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator

Problem

Unsloth Studio decided whether a Hub repo is MLX in two different ways, and each screen used only one of them:

Rule Used by
Repo name only (mlx-community/ owner, or an mlx segment in the repo name) Model picker format filter and MLX/Safetensors row labels, /api/models/list defaults
Model card only (library_name: mlx or an mlx tag) Hub page search format filter, On Device inventory, Hub inspector precision-folder card, picker precision-folder expansion, backend MLX precision-folder listing

The Hub marks a repo as MLX only from its README front-matter and never inspects the weights, so many real MLX uploads are untagged, and many tagged ones have no MLX in the name. The same repo therefore landed in different formats depending on the screen:

  • unsloth/gemma-4-E2B-it-UD-MLX-4bit (no mlx tag or library): MLX in the model picker, Safetensors on the Hub page and On Device, and no precision-folder expansion.
  • FluidVoice-Labs/Qwen3.5-9B-4bit (tagged mlx, no MLX in the name): MLX on the Hub page, Safetensors in the model picker.

Change

  • hub/lib/format-filters.ts owns both halves: hasMlxCardTag({ tags, libraryName }) and isMlxId(id, hintedIsMlx?), which mirrors isGgufId(id, hintedIsGguf). recommended-fit.ts re-exports them, so existing imports keep working.
  • Every surface that has both an id and model-card data now uses name OR tag: picker Hub search rows (filter, label, precision-folder click), picker search and recommended id filters (via the tags of the rows already fetched), cached rows, Hub search format, On Device inventory (cached repo id or local path/title), and the inspector precision-folder card.
  • matchesFormatFilter gains an optional hintedIsMlx and keeps GGUF precedence: a GGUF repo's mlx tag never moves it into the MLX filter, matching detectResultFormat. Name-based behaviour for GGUF ids is unchanged.
  • Backend: the name rule moves from routes/models.py to hub/utils/mlx_variants.py as looks_like_mlx_repo, so the MLX precision-folder listing in hub/services can accept name-matched repos too, without importing a route module.

All classification uses data the search listing already returns. No per-repo requests are added for classification.

Tradeoffs and scope

  • Clicking a picker row that matches only by name now makes the same single variants request that tagged rows already made, to look for precision folders.
  • Surfaces that only have an id (curated catalog seeds, hfModelFitsDevice, /api/models/list defaults, picker local rows) keep the name rule because they have no tag data.
  • Weight-based signals were considered and left out. A U32 dtype or quantization_config.bits without quant_method also matches non-MLX formats such as modelopt NVFP4, EXL3, CoreML, OpenVINO and ONNX exports.

Validation

# studio/frontend
node --experimental-strip-types --test tests/mlx-community-repo-detection.test.ts tests/hub-on-device-filters.test.ts tests/hub-recommended-format.test.ts tests/deferred-hardware-first-use.test.ts tests/npu-api.test.ts tests/audio-cpp-catalog.test.ts tests/audio-catalog-rows.test.ts tests/hub-model-run-selection.test.ts tests/unsloth-support-mixed-formats.test.ts
# 133 pass
node scripts/typecheck.mjs --tests
# clean

# studio/backend
python -m pytest -q tests/test_mlx_precision_variants.py tests/test_models_list_resident_gguf_label.py tests/test_mcp_tools_plan_load.py
# 88 passed
  • Tests: new tests cover each half of the rule on its own, GGUF precedence, On Device rows matched by cached repo id and by local path, and the backend precision-folder listing for name-only, owner-only, tag-only and library-only repos. Every new assertion was mutation-checked: removing each half of the rule or the GGUF guard fails its test.
  • Manual check: built the frontend and ran Unsloth Studio locally. On the Hub page, searching gemma-4-E2B-it-UD-MLX with the MLX format filter now lists unsloth/gemma-4-E2B-it-UD-MLX-4bit.

The model picker decided MLX by repo name only, while the Hub page search, On Device inventory, inspector precision card, picker precision-folder expansion and the backend precision-folder listing decided it by the model card's mlx tag or library_name only. The Hub only marks MLX from the model card, so untagged MLX uploads (including unsloth/*-MLX-* repos) and tagged repos without MLX in the name landed in different formats depending on the screen.

Add hasMlxCardTag and an optional hint to isMlxId (mirroring isGgufId) in hub/lib/format-filters.ts, and use name OR tag on every surface that has both. matchesFormatFilter keeps GGUF precedence so a GGUF repo's mlx tag never moves it into MLX. The backend name rule moves to hub/utils/mlx_variants.py as looks_like_mlx_repo and also gates the MLX precision-folder listing.
@Lyxot

Lyxot commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-06T19:27:05.543556Z 9034109 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

Unknown error
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Lyxot

Lyxot commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e2bf8169b2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

The cached inventory row's repo field holds only the repo name, so the mlx-community/ owner rule never matched there; use repoId.
@Lyxot

Lyxot commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: 9034109301

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Lyxot

Lyxot commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator Author

Review and CI status for 9034109:

  • Codex: Didn't find any major issues on 9034109.
  • CI: all 58 checks passed and 2 were skipped (0 failed), in a staging copy of this PR with the same head and base, Lyxot/unsloth#243, now closed. It was used because the checks here were all still queued.
  • Changed during review: 9034109 fixes the one Codex finding. On Device classified cached rows by repo, which holds only the repo name, so an untagged mlx-community/... repo showed as Safetensors; it now uses the full repoId, and the test uses the real row shape.

@NilayYadav

Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: 9034109301

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@NilayYadav NilayYadav self-assigned this Nov 6, 2026
@NilayYadav

Copy link
Copy Markdown
Collaborator

Review + reproduction evidence

Pinned review: 9034109. No blocking findings.

I checked both halves of the rule against live Hub data and ran the changed tests on the merge base f49ae10 and on the PR head (Linux, Node 22, Python):

  • Name-only MLX: unsloth/gemma-4-E2B-it-UD-MLX-4bit has no mlx tag and no library_name, so on the merge base the Hub page and On Device treat it as Safetensors while the picker shows MLX.
  • Tag-only MLX: of the top 500 repos tagged mlx by downloads, 70 have no MLX in the name (for example NexVeridian/Qwen3-Coder-Next-8bit), so the picker on the merge base labels them Safetensors.
  • GGUF precedence: 16 of those 500 are also tagged gguf. Every path in the diff checks GGUF before MLX (detectResultFormat, matchesFormatFilter, picker label and click, inspector, inventoryRowFormat), so these stay GGUF.
Check Merge base PR head
test_mlx_precision_variants.py + test_models_list_resident_gguf_label.py 35 passed, 2 failed (mlx-community/... and name-only ...-MLX repos get no precision folders) 37 passed
Frontend tests (the 9 files in the description) new MLX tests fail 133 / 133 passed
node scripts/typecheck.mjs --tests clean

The earlier review item (cached On Device rows classified by repo name instead of the full Hub id) is fixed in 9034109.

One small note on the description: FluidVoice-Labs/Qwen3.5-9B-4bit currently has no mlx tag or library on the Hub, so it no longer illustrates the tag-only case. A repo like NexVeridian/Qwen3-Coder-Next-8bit does.

Conclusion: the inconsistency is real on main and the PR fixes it on every surface that has both an id and model-card data, with GGUF precedence kept. Tests discriminate. Not yet covered: before/after screenshots of the Hub page and picker.

@NilayYadav
NilayYadav merged commit 1bf139b into unslothai:main Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants