Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🪜 Stepwise supervision dataset type #2148

Merged
merged 20 commits into from
Nov 18, 2024
Merged

🪜 Stepwise supervision dataset type #2148

merged 20 commits into from
Nov 18, 2024

Conversation

qgallouedec
Copy link
Member

@qgallouedec qgallouedec commented Oct 1, 2024

This PR aims to create a standard for stepwise data

Related: #2110

Chosen name: Stepwise supervision
Columns: "prompt", "completions", "labels"
Structure:

standard_example = {
    "prompt": "Beautiful is better than",
    "completions": [", let me think...", " ugly."],
    "labels": [False, True],
}

TODO

  • Update dataset format doc
  • Update internal testing dataset (zen)
  • Create a script for having our getting started script (from PRM800K?)

@HuggingFaceDocBuilderDev

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.

@qgallouedec qgallouedec marked this pull request as draft October 4, 2024 08:01
trl/data_utils.py Outdated Show resolved Hide resolved
trl/data_utils.py Outdated Show resolved Hide resolved
@lewtun
Copy link
Member

lewtun commented Nov 15, 2024

@qgallouedec I think this PR is mixing two concepts together:

  • Stepwise / process supervision: here one has a single prompt and N steps, where each step is assigned a score (not a preference label).
  • Multi-step preferences: here one has a prompt with a tree of (typically) paired preferences, similar to the MCTS DPO paper.

For stepwise supervision, I think the dataset structure can be quite simple:

{
    "prompt": "What number is larger, 9.8 or 9.11?",
    "completions": ["Step 1 ...", "Step 2 ...", ...],
    "labels": [0.6, 0.9, ...], # Can also be bools
}

WDYT about splitting this PR so that we target stepwise supervision first and include multistep preferences only if we end up extending the DPO trainer in that direction?

I'm happy to open a separate PR for stepwise supervision if you prefer

@qgallouedec
Copy link
Member Author

qgallouedec commented Nov 15, 2024

The main intention was to implement stepwise process supervision. The doc isn't probably clear enough. Feel free to recommend/directly change anything that made you think it was multi-step preferences.
Related: #2148 (comment)

Copy link
Member

@lewtun lewtun left a comment

Choose a reason for hiding this comment

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

Thanks for working on a standard format for stepwise supervision @qgallouedec ! The main comment I have is whether this should be grouped with preference learning or not and whether we should bother with the conversational format for now since I've never seen this used in practice (everything is single-turn thus far)

docs/source/dataset_formats.mdx Outdated Show resolved Hide resolved
docs/source/dataset_formats.mdx Outdated Show resolved Hide resolved
docs/source/dataset_formats.mdx Outdated Show resolved Hide resolved
docs/source/dataset_formats.mdx Outdated Show resolved Hide resolved
docs/source/dataset_formats.mdx Outdated Show resolved Hide resolved
docs/source/dataset_formats.mdx Outdated Show resolved Hide resolved
"completions": [" scatters more in the atmosphere,", " so the sky is green."],
"labels": [True, False]
}
# Conversational format
Copy link
Member

Choose a reason for hiding this comment

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

As mentioned above, I don't think this format applies to process supervision

Copy link
Member Author

Choose a reason for hiding this comment

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

removed in fe98b5b

| Preference with implicit prompt | [🔗](#from-preference-with-implicit-prompt-to-language-modeling-dataset) | [🔗](#from-preference-with-implicit-prompt-to-prompt-completion-dataset) | [🔗](#from-preference-with-implicit-prompt-to-prompt-only-dataset) | N/A | [🔗](#from-implicit-to-explicit-prompt-preference-dataset) | [🔗](#from-preference-with-implicit-prompt-to-unpaired-preference-dataset) |
| Preference | [🔗](#from-preference-to-language-modeling-dataset) | [🔗](#from-preference-to-prompt-completion-dataset) | [🔗](#from-preference-to-prompt-only-dataset) | [🔗](#from-explicit-to-implicit-prompt-preference-dataset) | N/A | [🔗](#from-preference-to-unpaired-preference-dataset) |
| Unpaired preference | [🔗](#from-unpaired-preference-to-language-modeling-dataset) | [🔗](#from-unpaired-preference-to-prompt-completion-dataset) | [🔗](#from-unpaired-preference-to-prompt-only-dataset) | N/A | N/A | N/A |
| From \ To | Language modeling | Prompt-completion | Prompt-only | Preference with implicit prompt | Preference | Unpaired preference | Stepwise unpaired preference |
Copy link
Member

Choose a reason for hiding this comment

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

If you agree with my comment about not treating this as preference learning, then we might want to move this to it's own row for stepwise supervision

Copy link
Member Author

Choose a reason for hiding this comment

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

Done in fe98b5b

trl/data_utils.py Outdated Show resolved Hide resolved
trl/data_utils.py Outdated Show resolved Hide resolved
@qgallouedec qgallouedec changed the title [Open discusion] Multistep dataset 🪜 Stepwise supervision dataset type Nov 15, 2024
@qgallouedec qgallouedec marked this pull request as ready for review November 15, 2024 17:26
Copy link
Member

@lewtun lewtun left a comment

Choose a reason for hiding this comment

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

Thanks for iterating @qgallouedec - this looks great now and the PRM dataset is a very useful starting point for the PRM PR @gaetanlop

@qgallouedec qgallouedec merged commit 76dbb1a into main Nov 18, 2024
14 checks passed
@qgallouedec qgallouedec deleted the step-dataset branch November 18, 2024 08:58
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.

4 participants