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

Custom losses redesign in alignment section #2206

Open
krammnic opened this issue Dec 25, 2024 · 0 comments
Open

Custom losses redesign in alignment section #2206

krammnic opened this issue Dec 25, 2024 · 0 comments

Comments

@krammnic
Copy link
Contributor

krammnic commented Dec 25, 2024

We have passed several iterations speaking about custom contrastive losses in torchtune. The last point in this direction was the deprecation of SimPO #2062 and the prohibition of new custom losses #2035 for the following reasons:

  1. Usually new loss requires additional checks like
    if isinstance(loss, SimPO)
  2. With highly active development of the field, new SOTA contrastive losses and methods are invented really often (workshops on A* about alignment).
  3. It is pretty difficult to support all losses in general (see IPO loss problem) remove ipo loss + small fixed #1615 

But deletion without any solution is not a good way either. Custom losses right now require modifications of the recipe. After some discussion with @SalmanMohammadi, we propose the following:

  1. Add a way to pass a custom loss for DPO in the recipe and custom forward without hard-coding args and outputs of the forward.
        1.1 Probably just an argument in the recipe
  2. Add a docs section with a brief explanation of how to do it and reference implementations for some SOTA losses (this section will not be updated with new losses releases as it is about design).

Will open PR

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

No branches or pull requests

1 participant