Align tiny Mistral v0.2 config with mistralai/Mistral-7B-Instruct-v0.2 - #7204
Open
albertvillanova wants to merge 1 commit into
Open
albertvillanova wants to merge 1 commit into
albertvillanova wants to merge 1 commit into
Conversation
Member
Author
|
The CI model has been regenerated and the corresponding Hub PR is open. It needs to be merged once this PR is approved: |
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
qgallouedec
approved these changes
Sep 14, 2026
qgallouedec
reviewed
Sep 14, 2026
| generation_config = GenerationConfig.from_pretrained(MODEL_ID) | ||
| config = MistralConfig( | ||
| vocab_size=len(tokenizer.vocab), | ||
| vocab_size=32000, |
Member
There was a problem hiding this comment.
The vocabulary size were tiny back then
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR aligns the
tiny-MistralForCausalLM-0.2generator config with its reference model,mistralai/Mistral-7B-Instruct-v0.2.Part of #7137. Sibling of #7203, which does the same for v0.1.
Motivation
The script builds
MistralConfigfrom architecture arguments only, so every field not passed falls backto the class default. Four of them diverge from the reference.
The sharpest is
sliding_window.MistralConfigdefaults to4096, and v0.2 is the release thatremoved sliding-window attention, so the reference sets it to
None. The tiny model therefore runssliding-window attention where the model it stands in for does not, which is not a scaled-down v0.2 but a
different attention configuration.
Solution
Mirror the reference values:
sliding_window=None(reference disables it; class default is4096)rope_theta=1000000.0(reference override; class default is10000.0)max_position_embeddings=32768(reference value; class default is131072)rms_norm_eps=1e-05(reference value; class default is1e-06)vocab_size=32000, matchinglen(tokenizer.vocab)today and pinned so the config no longer depends onthe tokenizer files at generation time
Before
After
Every remaining row is the deliberate size reduction. Produced with
print_config_diffattransformers==4.56.2, the versioncheck_transformers_version()pins. The Hub repo needs regeneratingfor this to take effect.
Changes
vocab_sizeto the reference's 32000sliding_window,rope_theta,max_position_embeddingsandrms_norm_epsfrom the reference configNote
Low Risk
Script-only change to tiny test model generation; no runtime library or production model behavior unless the Hub artifact is regenerated.
Overview
Updates the tiny Mistral v0.2 generation script so
MistralConfigmatchesmistralai/Mistral-7B-Instruct-v0.2on non-size fields, instead of relying onMistralConfigdefaults that diverge from the reference.vocab_sizeis pinned to 32000 (replacinglen(tokenizer.vocab)).sliding_window=None,rope_theta=1000000.0,max_position_embeddings=32768, andrms_norm_eps=1e-05are set explicitly—most notably disabling sliding-window attention, which v0.2 removed but the class still defaults to 4096.After regeneration,
print_config_diffshould only show the intentional tiny architecture shrink (hidden size, layers, heads, etc.).Reviewed by Cursor Bugbot for commit 1c912c9. Bugbot is set up for automated code reviews on this repo. Configure here.