Skip to content

feat(convert): allow fixed Unsloth maps without imatrix - #99

Merged
Brooooooklyn merged 4 commits into
mainfrom
feat/ornith-unsloth-no-imatrix
Jul 20, 2026
Merged

Brooooooklyn merged 4 commits into
mainfrom
feat/ornith-unsloth-no-imatrix

Conversation

@Brooooooklyn

@Brooooooklyn Brooooooklyn commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • allow the verified official Qwen3.5/Qwen3.6 MXFP4/MXFP8 and NVFP4/MXFP8 class maps to run without an imatrix
  • keep legacy affine Unsloth fail-closed and require --imatrix-path
  • verify the model family and sanitized hybrid tensor shape before allowing a no-imatrix request, in both SafeTensors and direct GGUF conversion paths
  • warn that AWQ pre-scaling is skipped and quantization quality may be lower while preserving the fixed class map
  • update CLI help, documentation, and regression coverage

Why

The fixed Unsloth class maps are deterministic, but the converter previously rejected every Unsloth invocation without an imatrix. That blocked compatible checkpoints which do not publish calibration data. Simply removing the early check would be unsafe because unsupported or ambiguous inputs could silently fall back to the legacy Dynamic 2.0 predicate without AWQ calibration.

This change only defers the imatrix requirement for --q-mxfp and --q-mode nvfp4, then requires the backend's existing Qwen family and hybrid-shape verification to select an official map. All other no-imatrix Unsloth requests still fail.

Validation

  • yarn vp test packages/cli/__test__/convert-cmd.test.ts --run — 19 passed
  • cargo test -p mlx-core unsloth_no_imatrix --lib — 3 passed
  • yarn typecheck
  • cargo fmt --all -- --check
  • git diff --check
  • converted Ornith-1.0-35B through both no-imatrix paths:
    • MXFP variant: 192 MXFP4 + 179 MXFP8 tensors
    • DGX variant: 192 NVFP4 + 179 MXFP8 tensors
    • both outputs: 1,437 indexed tensors, 371 scales, zero affine biases, five shards

Note

Medium Risk
Changes quantization validation and conversion entry points across Rust and CLI; incorrect gating could reject valid converts or allow low-quality legacy Unsloth without calibration, but scope is limited to convert tooling rather than runtime inference or auth.

Overview
Unsloth without calibration is now allowed only for the verified official Qwen3.5/Qwen3.6 fixed class maps (--q-mxfp or --q-mode nvfp4). Legacy affine --q-recipe unsloth still requires --imatrix-path.

The converter adds early and late imatrix gates in convert.rs (shared by SafeTensors and GGUF): defer fixed-map requests at the CLI, then fail closed if family/shape verification does not select an official map—so callers cannot silently fall back to legacy Dynamic 2.0 without AWQ. Official-map selection runs before model-specific branches (e.g. privacy-filter) so dedicated predicates cannot skip that check. A warning is emitted when AWQ pre-scaling is skipped.

CLI and docs mirror the policy: optional imatrix for fixed maps, warnings on no-imatrix runs, and tests for legacy rejection vs allowed MXFP/NVFP paths. mlx convert rejects --quantize on foreign types pp-lcnet-ori and uvdoc before backend conversion.

The GRPO optimizer round-trip test is rewritten to seed a deterministic AdamW SafeTensors fixture and exercise load → save → load → save on the model thread, replacing flaky GRPO training/retry logic.

Reviewed by Cursor Bugbot for commit ec4d953. Bugbot is set up for automated code reviews on this repo. Configure here.

@cursor

cursor Bot commented Jul 20, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_6391df47-ba78-43bf-9ebc-ca5281156021)

@coderabbitai

coderabbitai Bot commented Jul 20, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3a05469c-0c01-4b10-927d-e095571a5c60

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/ornith-unsloth-no-imatrix

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@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: 4d37ac4fde

ℹ️ 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 crates/mlx-core/src/convert.rs Resolved
@cursor

cursor Bot commented Jul 20, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_13c3f5af-61dd-492b-a5c5-5c361c456633)

@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: 28636f9fdb

ℹ️ 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 packages/cli/src/commands/convert.ts Resolved
@cursor

cursor Bot commented Jul 20, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_ad248a0f-530f-4850-9b07-dc91f7e2aff9)

@cursor

cursor Bot commented Jul 20, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_3f37a8b5-afe7-46de-92ed-1890f8e3e761)

@Brooooooklyn
Brooooooklyn merged commit b9260e7 into main Jul 20, 2026
7 checks passed
@Brooooooklyn
Brooooooklyn deleted the feat/ornith-unsloth-no-imatrix branch July 20, 2026 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant