prompt_strategies.ebft.ebft_reasoning
prompt_strategies.ebft.ebft_reasoning
Dataset transform for reasoning/thinking datasets with EBFT.
Handles datasets where assistant responses contain
Two variants:
transform— For structured EBFT (vLLM mode): Returns prompt + ground_truth with thinking tags preserved. Feature matching compares full responses (thinking + answer).transform_answer_only— For structured EBFT (vLLM mode): Strips… from ground_truth, so feature matching only scores the final answer portion. Use when reasoning chains can vary but the answer should match.transform_strided— For strided EBFT: Tokenizes the full conversation with thinking traces. Optionally masks thinking tokens from CE loss (labels=-100 for think spans) while still placing anchors in thinking regions for feature matching.
All variants work with OpenAI chat format
{“messages”: [{“role”: “…”, “content”: “
Functions
| Name | Description |
|---|---|
| transform | Full response including thinking traces for feature matching. |
| transform_answer_only | Strip thinking from ground_truth — match features on answer only. |
| transform_split_thinking | Split |
| transform_strided | For strided EBFT: tokenize with thinking, optionally mask think tokens from CE loss. |
transform
prompt_strategies.ebft.ebft_reasoning.transform(cfg, **kwargs)Full response including thinking traces for feature matching.
For datasets where assistant content has
transform_answer_only
prompt_strategies.ebft.ebft_reasoning.transform_answer_only(cfg, **kwargs)Strip thinking from ground_truth — match features on answer only.
transform_split_thinking
prompt_strategies.ebft.ebft_reasoning.transform_split_thinking(cfg, **kwargs)Split
For datasets where thinking is embedded in the content field as
The prompt messages are passed through with reasoning_content properly split, so vLLM generation with enable_thinking=true produces comparable outputs. The ground_truth is the full assistant response (thinking + answer) for feature matching.
Also works for:
-
transform_strided
prompt_strategies.ebft.ebft_reasoning.transform_strided(cfg, **kwargs)For strided EBFT: tokenize with thinking, optionally mask think tokens from CE loss.
Config options (via cfg):
- ebft.mask_thinking_ce: bool (default False)
If True, set labels=-100 for tokens inside