Skip to content

MLX: Clef Omni in Unsloth Studio, with audio in the Decision API and decision training - #13538

Merged
danielhanchen merged 15 commits into
unslothai:mainfrom
Lyxot:mlx-decision-omni
Oct 14, 2026
Merged

danielhanchen merged 15 commits into
unslothai:mainfrom
Lyxot:mlx-decision-omni

Conversation

@Lyxot

@Lyxot Lyxot commented Oct 13, 2026 •

Copy link
Copy Markdown
Collaborator

What this adds

unsloth-zoo's MLX decision engine serves and trains a Clef on an omni base model, which hears audio as well as reading images (unslothai/unsloth-zoo#1689, merged). Neither FastDecisionModel nor Unsloth Studio had a way to hand it audio, and Unsloth Studio did not offer Clef Omni at all. This is the companion change, for Apple Silicon only. It also makes training a plain text, vision or omni model as a decision model (a fresh Clef head) work end to end on a Mac: train, save, serve.

One commit per piece:

  1. FastDecisionModel on MLX carries audio. build_dataset reads a row's "audio" (data URLs, the {"bytes", "path"} of an undecoded audio column, decoded {"array", "sampling_rate"} clips at 16 kHz mono, or the decoder object datasets 4 yields), and predict(..., audio=) takes the same forms. With an unsloth-zoo that takes no audio both raise an ImportError asking for a newer one, where skipping the rows would silently train without them. Laya's predict refuses audio, as it refuses images, and the Unsloth Studio training page blocks an audio dataset for a Laya run. Rows whose audio the model cannot hear or that cannot be decoded are skipped with the reason in the dataset report, as image rows are.
  2. The Decision API takes audio. POST /v1/systemone accepts audio: up to 8 base64 data:audio/... URLs, 40 MiB together, beside images. The route checks count, shape, base64 and size; the engine decodes and applies its own length limit. Audio is never dropped: only the MLX engine serving a Clef that hears answers such a request. Any other model, the PyTorch or llama.cpp runtime, and a Decision API connection refuse it with a 4xx that says why. Settings and /v1/models report audio in input_modalities for a model that hears.
  3. Clef Omni in the Decision API catalog. clef-omni is mlx-community/clef-omni-8bit (33 GB). It is the first catalog entry whose own backend is MLX: it is served by the MLX engine or refused, under every runtime setting, the way a GGUF entry is served by llama.cpp or refused. Where the engine is not available (not Apple Silicon, or the Decision API set to CPU) the settings list it as unavailable with the reason.
  4. Clef Omni on the training page. On a Mac the model picker pins mlx-community/clef-omni-8bit. The Hub tag clef now marks a decision model before the model's config loads, so a Clef repo tagged for audio is no longer read as a chat audio model and refused on a Mac. A Clef decision run on a Mac is no longer held to the chat audio limits: the MLX trainer reads the audio in its own rows and reports the ones the model cannot hear, so a dataset with an audio column can start, and the request no longer carries the chat audio flag the backend refuses on Apple Silicon. Laya, a Clef on another device and chat models are held as before.
  5. A plain model given a decision head starts on rows with audio on a Mac, as a Clef does: its trainer reads the rows the same way, and skips with a warning the audio a text or vision model cannot hear.
  6. An offline decision run on a plain model no longer fails at start. Offline, or when the Hub cannot be reached, preflight asks the worker to validate a cached model pin; a decision run clears the pin, since its trainer resolves the model itself, but left that request, so the worker refused with "cached model snapshot selected during preflight is no longer available".
  7. A saved Phi-4-multimodal or Nemotron Omni decision model reports the images and audio it reads. Whether a local Clef folder reads images or audio was taken from a vision_config or audio_config in its config. Phi-4-multimodal names its towers under embd_layer, and Nemotron Omni its audio tower sound_config, so either was served as text only.
  8. Decision rows from S3 keep their audio. An S3 download rewrites a manifest's audio references to the downloaded files, then deletes them once the dataset is read, before training reads a clip. A decision run now reads the clips of the rows it keeps into those rows first, and the rewrite also reaches a row that lists several clips.

Scope: MLX only

llama.cpp has no decision graph for Clef Omni, so there is no GGUF entry and nothing changes on the GGUF side: export_decision_gguf already refuses a Clef whose backbone is not Qwen3.5. The PyTorch decision path is not touched.

Depends on

Not in this PR

  • Audio in the Decision API Try dialog, the MCP decide tool, and Decision API connections.
  • A minimum unsloth-zoo version: with one that predates Clef Omni support the entry fails at load.
  • clef-omni is still listed by /v1/models on machines that cannot serve it, as GGUF entries are without a llama-server; a request for it gets a 400 with the reason.
  • mlx-community/NVIDIA-Nemotron-3-Nano-Omni-30B-A3B-4bit keeps its decoder as top-level backbone.*, which mlx-vlm does not load for chat training either; mlx-community/Nemotron-3-Nano-Omni-30B-A3B-Reasoning-8bit works.

Validation

python -m pytest tests/test_decision_model_mlx.py -q
cd studio/backend && python -m pytest tests/test_decision_serving.py tests/test_systemone.py tests/test_decision_native.py tests/test_decision_training_route.py -q
cd studio/frontend && node --experimental-strip-types --test tests/training-decision-model.test.ts tests/training-validation.test.ts && npm run typecheck

On an M3 Max, with the unsloth-zoo fixes above:

  • POST /v1/systemone with model clef-omni and one WAV clip names the clip's topic at 0.97 to 0.99 confidence for three different clips and for a 44.1 kHz stereo one; two clips and no clip answer differently; an undecodable clip is a 422. The response header reports the mlx backend and the settings report ["text", "image", "audio"].
  • Each model below was trained offline through POST /api/train/start as the training page sends a decision run (12 rows: audio only, image only, image and audio, text only; 12 steps), saved, set as the Decision API model and asked with text, an image and three clips:
Model Head Answered Refused (400)
Qwen/Qwen3-0.6B fresh text image, audio
Qwen/Qwen3.5-0.8B fresh text, image audio
google/gemma-4-E2B-it fresh text, image, audio
mlx-community/Qwen3-Omni-30B-A3B-Instruct-4bit fresh text, image, audio
mlx-community/Nemotron-3-Nano-Omni-30B-A3B-Reasoning-8bit fresh text, image, audio
microsoft/Phi-4-multimodal-instruct fresh text, image, audio
mlx-community/clef-omni-8bit Clef Omni text, image, audio
Cloudflare/clef (QLoRA setting) Clef text, image audio

UI before and after

Settings > API keys > Decision API > Model on a Linux CUDA host (merge base vs this PR): the list gains a disabled "Clef Omni 35 GB" row whose hover reason reads "clef-omni is served only by MLX. The MLX runtime needs Apple Silicon with the Decision API on the GPU."; every other row is unchanged.

Decision API model list before and after

@Lyxot
Lyxot requested a review from danielhanchen as a code owner October 13, 2026 05:45
@Lyxot Lyxot added the MLX label Oct 13, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 13, 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 ⚠️ Failed 2026-10-14T15:18:56.635592Z 6f50d70 New commits
ℹ️ 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.

@Lyxot
Lyxot marked this pull request as draft October 13, 2026 05:55
@Lyxot
Lyxot force-pushed the mlx-decision-omni branch from 3046769 to 0ed0dc3 Compare October 13, 2026 06:37
@Lyxot Lyxot changed the title feat(mlx): decision rows and predict carry audio for a Clef that hears it MLX: Clef Omni in Unsloth Studio, with audio in the Decision API and decision training Oct 13, 2026
@Lyxot
Lyxot marked this pull request as ready for review October 13, 2026 06:50
@Lyxot
Lyxot marked this pull request as draft October 13, 2026 09:16
@Lyxot
Lyxot force-pushed the mlx-decision-omni branch from c186786 to 296a39d Compare October 14, 2026 07:42
@Lyxot
Lyxot marked this pull request as ready for review October 14, 2026 07:44
@Lyxot Lyxot removed the conflicts# label Oct 14, 2026
chatgpt-codex-connector[bot]

This comment was marked as resolved.

@Lyxot

Lyxot commented Oct 14, 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: 98d6e8c4d5

ℹ️ 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 Oct 14, 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: 4cd690292b

ℹ️ 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".

Comment thread unsloth/models/decision_mlx.py Resolved
Comment thread unsloth/models/decision_mlx.py Resolved
@Lyxot

Lyxot commented Oct 14, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Failed to sample tokens
ℹ️ 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 added 6 commits October 14, 2026 17:42
…s it

FastDecisionModel.build_dataset reads a row's "audio" (data URLs, an undecoded audio column's bytes or file, or decoded 16 kHz mono clips) and predict takes audio = the same way, passing both to unsloth-zoo's MLX decision engine. An unsloth-zoo that takes no audio is reported instead of training without those rows, as for images.
…ough MLX

POST /v1/systemone accepts `audio`, an array of base64 data URLs, beside `images`. Only unsloth-zoo's MLX engine hears, so a request with clips is answered by a Clef that has an audio tower on Apple Silicon or refused: an entry that does not hear, a PyTorch or llama.cpp runtime setting, and a Decision API connection all say so instead of answering without the clips. The route checks the number of clips, their shape and their total size; the engine decodes them. Such a Clef lists `audio` among its input modalities. A local Clef folder that keeps its towers under `thinker_config` is now recognized as reading images too.
@Lyxot

Lyxot commented Oct 14, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Failed to sample tokens
ℹ️ 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 Oct 14, 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: 03f899b813

ℹ️ 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 Oct 14, 2026

Copy link
Copy Markdown
Collaborator Author

Review and CI summary

Codex: five review rounds ran; the last, on the current head 03f899b813, is #13538 (review). Its two findings were answered in their threads without a code change: the training page's refusal of S3 datasets for vision models is main's existing gate for every vision model, and JSON clip objects inside S3 CSV cells are not a manifest shape the S3 path reads. Every review thread is resolved. Two further requests failed on the Codex side ("Failed to sample tokens") and were retried.

CI on a copy of this head and base, run while the upstream checks were queued (Lyxot#163): 60 passed, 7 skipped, 2 failed. Both failures come from main at the base 42625f0bef and reproduce there unchanged; this PR touches none of the files involved.

  • Frontend build + bundle sanity stops at locale parity (skills.turnOff, rewind.filesNotRestored, settings.data.library.filesNotRestored). Since that step skips the rest of the job, typecheck, build and the startup bundle budget were run on this head separately: all pass, 4.9 KB of transfer under the budget.
  • Repo tests (CPU, studio): 6 failures in tests/studio/test_deep_research_frontend_contract.py and tests/studio/test_token_count_prompt_parity.py (ReferenceError: skillsForTools is not defined), the same 6 on the base; the other 9,189 tests pass.

Changed during review:

  • Rebased onto main at 42625f0bef. On the old base the 67 B of transfer this PR adds to the eager startup JS took the bundle over the startup budget; on the new base it adds 285 B raw and 137 B transfer and fits the budget main has since re-measured.
  • e0d06bd200, c692643b1c: decision rows from an S3 dataset keep their audio after the download is cleaned up, reading in only the clips of the rows the run's slice keeps.
  • de0337081b: an audio clip the datasets decoder cannot read skips and reports its row instead of aborting build_dataset.
  • 03f899b813: the S3 manifest rewrite reaches a row that lists several clips.
  • Description: item 1's Laya wording corrected (Laya's predict refuses audio; the training page blocks an audio dataset for a Laya run) and item 8 added for the S3 audio handling.

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Failed to sample tokens
ℹ️ 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".

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: 039896fb8f

ℹ️ 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".

danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 14, 2026
@danielhanchen
danielhanchen merged commit daab3bc into unslothai:main Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants