Repository navigation
Support assistant-only loss for the Inkling chat template - #8513
Merged
Merged
Conversation
21 of 44 tasks
albertvillanova
force-pushed
the
support-inkling-assistant-only-loss
branch
from
November 23, 2026 09:16
dc5ccf3 to
dec333d
Compare
albertvillanova
marked this pull request as ready for review
November 24, 2026 05:24
|
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. Pages changed in this PR: |
albertvillanova
force-pushed
the
support-inkling-assistant-only-loss
branch
2 times, most recently
from
November 24, 2026 10:51
14abbd4 to
f5f463d
Compare
qgallouedec
approved these changes
Nov 24, 2026
albertvillanova
force-pushed
the
support-inkling-assistant-only-loss
branch
from
November 24, 2026 12:25
f5f463d to
236e310
Compare
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 makes
assistant_only_loss=Truework for the Inkling chat template:thinkingmachines/Inkling,thinkingmachines/Inkling-Smallandthinkingmachines/Inkling-Small-NVFP4, which ship the same template.Part of #7962.
Motivation
TRL does not store the Inkling template, and it has no
{% generation %}markers, soget_training_chat_templateraises andSFTTrainerwithassistant_only_loss=Truefails at init.Changes
inkling.jinja, the original template, andinkling_training.jinja. The training template wraps each assistant turn with{% generation %}markers. The first<|message_model|>of the turn stays outside, since the generation prompt already ends with it. The later ones, between the reasoning, text and tool-call messages, are generated by the model, so they stay inside, with the closing<|content_model_end_sampling|>. The rendered text is unchanged.check_chat_templates.py, and document the templates.On the real
thinkingmachines/Inkling-Smalltokenizer, the training template renders like the original, keeps prefix preservation and trains the stop token. The trained spans start right after the generation prompt.This PR is stacked on #8512, which adds the generation script for
trl-internal-testing/tiny-InklingForConditionalGeneration; the tests run on that model.Note
Low Risk
Adds a new model-family template path and tests; no changes to auth, security, or core training loops beyond template selection.
Overview
Adds first-class Inkling chat template support so
SFTTrainerwithassistant_only_loss=Trueworks forthinkingmachines/Inklingand related checkpoints.Ships
inkling.jinja(Hub reference) andinkling_training.jinja, which wrap each assistant turn in{% generation %}markers while keeping the opening<|message_model|>outside the mask (generation prompt) and reasoning, text, tool-call segments, plus<|content_model_end_sampling|>inside.get_training_chat_templatemaps the base template to the training variant. Docs,trl/chat_templates/README.md, the template drift check (thinkingmachines/Inkling), and the existing training-template test suite are updated for the new family.Reviewed by Cursor Bugbot for commit 236e310. Bugbot is set up for automated code reviews on this repo. Configure here.