Skip to content

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

Draft
bvolpato wants to merge 1 commit into
NovaSky-AI:mainfrom
bvolpato:bvolpato/prompt-filter-chat-template-kwargs
Draft

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

Conversation

@bvolpato

@bvolpato bvolpato commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Problem

PromptDataset filters examples by calling tokenizer.apply_chat_template without generator.chat_template_kwargs. Generation later applies those kwargs. Options such as enable_thinking can change rendered prompt length, so filtering measures a different prompt from the one sent to inference. Over-length prompts may pass preprocessing and fail only at runtime; valid prompts can also be filtered using the wrong template mode.

Change

  • add optional chat_template_kwargs to PromptDataset
  • pass generator.chat_template_kwargs to both training and evaluation datasets
  • use those kwargs in length-filter tokenization

Why this belongs in SkyRL

SkyRL owns preprocessing and passes these tokenizer options during generation. Length filtering must use same configured kwargs to enforce trainer.max_prompt_length against prompt that will run. Fix applies to any tokenizer kwarg that changes rendering, not one model family.

Compatibility

  • default empty kwargs preserve existing rendering exactly
  • custom chat-template selection is outside this change
  • dataset records and collated batch format do not change
  • no inference request or response contract changes
  • configured kwargs are forwarded unchanged to tokenizer

Validation

  • added focused regression coverage where thinking mode changes prompt from one token to four
  • confirmed filter uses configured mode and rejects prompt at correct limit
  • focused dataset tests: 2 passed
  • changed-file Ruff, Black, and hardcoded-secret checks pass

CI note

Current full-tree Black failure is already present on main in tests/tinker/test_engine.py and is isolated in #2009.

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

1 participant