Skip to content

Add a tiny Inkling 2 model and run it in the VLM tests - #8498

Merged
qgallouedec merged 11 commits into
mainfrom
inkling2-tiny-model
Nov 25, 2026
Merged

qgallouedec merged 11 commits into
mainfrom
inkling2-tiny-model

Conversation

@qgallouedec

@qgallouedec qgallouedec commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

Part of #8497.

Adds a tiny Inkling 2 (trl-internal-testing/tiny-Inkling2ForConditionalGeneration) mirroring thinkingmachines/Inkling-2-Small-MXFP8: one layer of each type, MXFP8 experts, and the reference's dtypes, tokens, chat template and generation config. It runs in the VLM tests next to Gemma 4. On transformers main, SFT, RLOO and Distillation on images, tool calling and response parsing pass. Expected to fail:


Note

Low Risk
Changes are limited to a new tiny-model generator script, test parametrization, and a Hub commit pin—no production training or inference paths are modified.

Overview
Adds a tiny Inkling 2 VLM (trl-internal-testing/tiny-Inkling2ForConditionalGeneration) and wires it through the existing VLM test matrix, alongside the new generation script that builds and uploads the checkpoint.

The new inkling2_for_conditional_generation.py script shrinks thinkingmachines/Inkling-2-Small-MXFP8 to two hybrid text layers plus a minimal vision tower, then exports weights in the reference layout: MoE experts in MXFP8 with per-block scales, attention-residual and router bias in float32, and the rest in bf16, including a trimmed hf_quant_config.json.

Trainer and utility tests register the model with transformers ≥ 5.23 skips and xfail markers where behavior is known broken (MXFP8 dequantization, GRPO reward parsing, async GRPO tree packing, fused LM head). testing_utils.py pins the Hub revision for reproducible CI.

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

@chatgpt-codex-connector

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

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-20T10:16:33.056924Z b6b7f10 PR opened
ℹ️ 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.

@github-actions github-actions Bot added the 🔧 maintenance CI, tooling, tests, or repo upkeep label Nov 20, 2026
@bot-ci-comment

Copy link
Copy Markdown

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.

One layer of each type, the experts stored in MXFP8 with ue8m0 scales, the router and attention residual inputs in
float32, and the tokens, chat template and generation config of the reference, which now sets them.
#8484 fixed the image tiles. transformers < 5.24 loads the dequantized checkpoint in mixed dtypes, and dequantizing
the MXFP8 experts drops their scales, which breaks DPO, KTO and GRPO on main too.

@cursor cursor 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.

Stale Bugbot comment from a previous run.

MODEL_ID = "thinkingmachines/Inkling-2-Small-MXFP8"

processor = AutoProcessor.from_pretrained(MODEL_ID)
generation_config = GenerationConfig.from_pretrained(MODEL_ID)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Generator omits eos and pad tokens

Medium Severity

The generator loads the reference processor and never assigns eos_token or pad_token, even though this checkpoint's tokenizer does not define them. smoke_test pads a two-example batch, and trainers fall back to pad_token = eos_token, so both stay unset. Regenerating the Hub model therefore ships a tokenizer that cannot pad or end sequences.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 0c015a8. Configure here.

@qgallouedec qgallouedec mentioned this pull request Nov 20, 2026
6 of 16 tasks

@cursor cursor 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.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit ccb1a73. Configure here.

Comment thread tests/test_sft_trainer.py
reason="transformers < 5.24 loads the dequantized FP8 checkpoint in mixed dtypes "
"(huggingface/transformers#50595, huggingface/transformers#50975)",
strict=True,
),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

SFT image test missing mixed-dtype xfail

Medium Severity

The mixed-dtype xfail is applied to test_train_vlm but not to test_train_vlm_prompt_completion, which loads the same Inkling 2 checkpoint and trains on zen-image. On transformers < 5.24 that case fails for the same dequantized mixed-dtype reason, so the latest-transformers CI job errors instead of treating it as expected.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit ccb1a73. Configure here.

The tiny model's completions all parse to an empty answer, so every one gets the same reward: the advantages are zero
and GRPO trains nothing. The unscaled experts only break DPO and KTO.
qgallouedec and others added 4 commits November 24, 2026 11:39
# Conflicts:
#	tests/test_async_grpo_trainer.py
#	tests/test_chat_template_utils.py
#	tests/test_distillation_trainer.py
#	tests/test_dpo_trainer.py
#	tests/test_grpo_trainer.py
#	tests/test_kto_trainer.py
#	tests/test_rloo_trainer.py
#	tests/test_sft_trainer.py
#	tests/test_utils.py
@qgallouedec
qgallouedec merged commit 08fbacb into main Nov 25, 2026
11 of 12 checks passed
@qgallouedec
qgallouedec deleted the inkling2-tiny-model branch November 25, 2026 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🔧 maintenance CI, tooling, tests, or repo upkeep

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants