Skip to content

[fix][data] Apply chat-template kwargs during filtering - #2006

Open
bvolpato wants to merge 2 commits into
NovaSky-AI:mainfrom
bvolpato:bvolpato/prompt-filter-chat-template-kwargs
Open

[fix][data] Apply chat-template kwargs during filtering#2006
bvolpato wants to merge 2 commits into
NovaSky-AI:mainfrom
bvolpato:bvolpato/prompt-filter-chat-template-kwargs

Conversation

@bvolpato

@bvolpato bvolpato commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Summary

PromptDataset filtered examples without generator.chat_template_kwargs, while generation applied those options later. Settings such as enable_thinking can change rendered prompt length, so preprocessing could accept an over-length prompt or reject a valid one.

Changes

  • Add optional chat_template_kwargs to PromptDataset.
  • Pass generator chat-template options to training and evaluation datasets.
  • Apply those options during prompt-length filtering.
  • Share chat-template merging across filtering and non-batched generation, with explicit call controls taking precedence over configured kwargs.

Empty kwargs preserve existing behavior. Dataset records, collated batches, and inference contracts do not change.

Testing

  • Full SkyRL Train CPU suite (1464 passed, 7 skipped, 5 deselected)
  • Dataset suite (9 passed)
  • Generator suite (32 passed)
  • Collision regressions for thinking mode and explicit add_generation_prompt, return_dict, and tokenize controls (3 passed)
  • pre-commit run --all-files
  • git diff --check upstream/main

@bvolpato bvolpato changed the title [fix][train] Apply chat template kwargs during prompt filtering [fix][data] Align prompt filtering with generation templates Aug 10, 2026
@bvolpato bvolpato changed the title [fix][data] Align prompt filtering with generation templates [fix][data] Apply chat-template kwargs during filtering Aug 10, 2026
@SumanthRH

Copy link
Copy Markdown
Member

@bvolpato Thanks! is this ready for review?

@bvolpato
bvolpato force-pushed the bvolpato/prompt-filter-chat-template-kwargs branch from 0ccbb47 to 2e72dac Compare August 13, 2026 01:20
@bvolpato
bvolpato marked this pull request as ready for review August 13, 2026 01:23
@bvolpato

Copy link
Copy Markdown
Contributor Author

yes, ready for review now. I rebased it onto current main, reran the dataset suite and full pre-commit, and updated the PR description.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces support for passing custom chat_template_kwargs to the PromptDataset and its prompt filtering helper function, allowing configuration of the tokenizer's chat template application (e.g., enabling thinking tokens). Corresponding tests were added to verify this behavior. The review feedback suggests filtering out conflicting keys (add_generation_prompt, return_dict, tokenize) from chat_template_kwargs to prevent potential TypeErrors and logic breakage.

Comment thread skyrl/train/dataset/dataset.py Outdated
Preserve explicit tokenizer controls when configured chat template kwargs contain conflicting keys. Reuse merge logic across prompt filtering and non-batched generation.
@bvolpato
bvolpato force-pushed the bvolpato/prompt-filter-chat-template-kwargs branch from 5572a4a to 23a5d43 Compare August 14, 2026 04:39
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