Make the models a defaults file claims actually load it by vineethsaivs · Pull Request #8726 · unslothai/unsloth · GitHub
Skip to content

Make the models a defaults file claims actually load it - #8726

Merged
oobabooga merged 3 commits into
unslothai:mainfrom
vineethsaivs:fix/model-defaults-alias-resolution
Aug 17, 2026
Merged

Make the models a defaults file claims actually load it#8726
oobabooga merged 3 commits into
unslothai:mainfrom
vineethsaivs:fix/model-defaults-alias-resolution

Conversation

@vineethsaivs

Copy link
Copy Markdown
Contributor

Problem

A model id reaches its model_defaults YAML by one of two routes in load_model_defaults: an entry in MODEL_NAME_MAPPING, or the org/model to org_model.yaml filename convention. The primary name is always covered by the convention, so it cannot break. The aliases named in each file's # Also applies to: header can, and nine of them had.

Cross-checking every claimed alias against what load_model_defaults actually returns:

config alias that did not reach it
gemma/unsloth_gemma-4-31B-it.yaml unsloth/gemma-4-31B-it-GGUF
gemma/unsloth_gemma-4-26B-A4B-it.yaml unsloth/gemma-4-26B-A4B-it-GGUF
gemma/unsloth_gemma-4-E2B-it.yaml unsloth/gemma-4-E2B-it-GGUF
gemma/unsloth_gemma-4-E4B-it.yaml unsloth/gemma-4-E4B-it-GGUF
other/unsloth_GLM-4.7-Flash.yaml THUDM/GLM-4.7-Flash, unsloth/GLM-4.7-Flash-bnb-4bit, unsloth/GLM-4.7-Flash-unsloth-bnb-4bit
qwen/unsloth_Qwen3-30B-A3B-Instruct-2507.yaml Qwen/Qwen3-30B-A3B-Instruct-2507, unsloth/Qwen3-30B-A3B-Instruct-2507-bnb-4bit

Each one fell through to default.yaml, so the tuned hyperparameters were quietly replaced by generic ones. The backend log says so plainly, Loaded default model defaults from .../default.yaml rather than Loaded model defaults from .../<model>.yaml, but nothing surfaces that to the user; the training form just fills in with different numbers.

The MoE config shows the size of it best, since a 30B MoE is not something you want to train on generic defaults:

unsloth/Qwen3-30B-A3B-Instruct-2507             lora_r 32   batch_size 1   <- its own config
Qwen/Qwen3-30B-A3B-Instruct-2507                lora_r 16   batch_size 2   <- default.yaml
unsloth/Qwen3-30B-A3B-Instruct-2507-bnb-4bit    lora_r 16   batch_size 2   <- default.yaml

Qwen/Qwen3-30B-A3B-Instruct-2507 is the upstream id for the same weights, and THUDM/GLM-4.7-Flash likewise, so this is not an obscure spelling: it is what someone gets by pasting the model id from the Hub page rather than picking the Unsloth mirror.

Why the two of them broke

unsloth_GLM-4.7-Flash.yaml and unsloth_Qwen3-30B-A3B-Instruct-2507.yaml had no MODEL_NAME_MAPPING entry at all. They worked through the filename convention alone, which covers the primary name and nothing else, so their aliases had nowhere to resolve from. The four gemma-4 files had entries that listed the google/ alias but not the -GGUF one.

Fix

Add the nine claimed aliases, which is data only and purely additive. No behaviour outside these six configs changes.

Test

tests/test_model_defaults_aliases_resolve.py derives its cases from the YAML headers rather than hardcoding a list, so a future file that claims an alias it cannot resolve fails without anyone remembering to update the test. It parametrises over every # Also applies to: name (186 cases today) and asserts the alias loads the same dict as the config's own name.

It also asserts the fixture found more than 20 aliases, so a header reformat or a directory move fails loudly instead of leaving the test silently checking nothing.

                                           before                  after
test_model_defaults_aliases_resolve.py     9 failed, 177 passed    186 passed

The 9 failures name the exact alias, for example:

FAILED ...[unsloth_Qwen3-30B-A3B-Instruct-2507.yaml-Qwen/Qwen3-30B-A3B-Instruct-2507]
  Qwen/Qwen3-30B-A3B-Instruct-2507 is listed in unsloth_Qwen3-30B-A3B-Instruct-2507.yaml
  but loaded different defaults; it needs an entry in MODEL_NAME_MAPPING

Selecting the neighbouring suites with -k "model_config or model_defaults or mapping or yaml" gives 101 passed / 11 skipped both with this change and on a clean tree, so nothing else moved. test_audio_type_inconclusive.py and test_mcp_server.py are excluded from that run: they fail to import here for a missing unsloth_zoo and fastmcp, on a clean tree as well.

A model id reaches its model_defaults YAML either through MODEL_NAME_MAPPING
or through the org/model -> org_model.yaml filename convention. The primary
name is always covered by the convention, so only the aliases named in the
header comment can drift, and nine of them had:

    unsloth_gemma-4-31B-it.yaml            unsloth/gemma-4-31B-it-GGUF
    unsloth_gemma-4-26B-A4B-it.yaml        unsloth/gemma-4-26B-A4B-it-GGUF
    unsloth_gemma-4-E2B-it.yaml            unsloth/gemma-4-E2B-it-GGUF
    unsloth_gemma-4-E4B-it.yaml            unsloth/gemma-4-E4B-it-GGUF
    unsloth_GLM-4.7-Flash.yaml             THUDM/GLM-4.7-Flash
                                           unsloth/GLM-4.7-Flash-bnb-4bit
                                           unsloth/GLM-4.7-Flash-unsloth-bnb-4bit
    unsloth_Qwen3-30B-A3B-Instruct-2507.yaml
                                           Qwen/Qwen3-30B-A3B-Instruct-2507
                                           unsloth/Qwen3-30B-A3B-Instruct-2507-bnb-4bit

Each of those fell back to default.yaml, so the tuned hyperparameters were
replaced by generic ones without any sign to the user. The MoE config is the
clearest: unsloth/Qwen3-30B-A3B-Instruct-2507 loads lora_r 32 and batch_size 1,
while Qwen/Qwen3-30B-A3B-Instruct-2507, the upstream id for the same weights,
loaded lora_r 16 and batch_size 2.

GLM-4.7-Flash and Qwen3-30B-A3B-Instruct-2507 had no MODEL_NAME_MAPPING entry
at all and worked only through the filename convention, which is why their
aliases had nowhere to resolve from.
@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 4c5b3d5323

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

Reviewed commit: ff44bbae0f

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

@oobabooga

Copy link
Copy Markdown
Member

@oobabooga
oobabooga merged commit 4f5658a into unslothai:main Aug 17, 2026
30 of 35 checks passed
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.

2 participants