Live data from Hacker News

RLHF a LLM in <50 lines of Python

datadreamer.dev

11–20 of 68 posts

Re: RLHF a LLM in <50 lines of Python

#11
post #8

The first paragraphs says RLHF can be used to align models, and the seconds say here's how to do it by using DPO. These two methods are not the same, and the latter is not an instance of the former.

The latter is strictly superior to the former though. RlHF has been abandoned in the open source world.

I am just saying the intro paragraphs are confusing.

Re: RLHF a LLM in <50 lines of Python

#12
post #8

The first paragraphs says RLHF can be used to align models, and the seconds say here's how to do it by using DPO. These two methods are not the same, and the latter is not an instance of the former.

The latter is strictly superior to the former though. RlHF has been abandoned in the open source world.

Yep, DPO is not technically “RL” and implicitly uses the LLM itself as a reward model, but training with DPO is far more stable for that reason.

Re: RLHF a LLM in <50 lines of Python

#13
post #11

Earlier quoted context omitted.

The latter is strictly superior to the former though. RlHF has been abandoned in the open source world.

I am just saying the intro paragraphs are confusing.

Thanks, appreciate the feedback, will update when I get a chance!

Re: RLHF a LLM in <50 lines of Python

#14

Hi everyone, there are no easy tools for synthetic data generation or training and aligning LLMs simply in Python. Most of the stuff out there are messy adhoc scripts. DataDreamer is an open source Python package with a nice API from the University of Pennsylvania that does all this that we’re actively developing. Will be here to answer questions. https://github.com/datadreamer-dev/DataDreamer

The API looks nice, congratulations. Will experiment with it. One small silly question: why did you choose to specify the dependencies inside the src dir with the requirements format - rather than inside the pyproject?

Re: RLHF a LLM in <50 lines of Python

#15

Hi everyone, there are no easy tools for synthetic data generation or training and aligning LLMs simply in Python. Most of the stuff out there are messy adhoc scripts. DataDreamer is an open source Python package with a nice API from the University of Pennsylvania that does all this that we’re actively developing. Will be here to answer questions. https://github.com/datadreamer-dev/DataDreamer

The API looks nice, congratulations. Will experiment with it. One small silly question: why did you choose to specify the dependencies inside the src dir with the requirements format - rather than inside the pyproject?

Thanks! It makes it easier to run with the existing run scripts I have on our large university GPU cluster. :) no other reason

Re: RLHF a LLM in <50 lines of Python

#16
post #2

I don’t understand the obsession of LOC for wrappers - it’s the whole point of a wrapper. It makes it much easier for the user at the expense of making it less hackable Title should be instead “Library for low-code RLHF in python”

I always appreciate these projects because I just dive into the code itself and copy out what I need once the wrapper becomes too much of a burden.

That’s totally valid and something we would even encourage! This project is for researchers so if there is a point where the abstraction is no longer useful, by all means configure, or subclass, or copy code.

Re: RLHF a LLM in <50 lines of Python

#17
post #2

I don’t understand the obsession of LOC for wrappers - it’s the whole point of a wrapper. It makes it much easier for the user at the expense of making it less hackable Title should be instead “Library for low-code RLHF in python”

I always appreciate these projects because I just dive into the code itself and copy out what I need once the wrapper becomes too much of a burden.

Of course. And they're not saying they don't have a place.

They're saying why does it matter if it's 50 vs 60 or even 100. It's a wrapper, which should be less lines. That's the whole point. Abstracting things even further and making assumptions.

Of course you can use them. Of course you can remove them after and use the underlying code. But the LOC shouldn't be the important part of it

Re: RLHF a LLM in <50 lines of Python

#18

Earlier quoted context omitted.

The latter is strictly superior to the former though. RlHF has been abandoned in the open source world.

Yep, DPO is not technically “RL” and implicitly uses the LLM itself as a reward model, but training with DPO is far more stable for that reason.

DPO is as close to RL as RLHF. The latter also uses the LLM as a reward model.

I'm not a fan of the RL/SL dichotomy, because the line gets so foggy. If you squint, every loss is a negative reward, and every policy improvement a supervised target.

Still, what the code does isn't what is described in the paper that the page links to.

Re: RLHF a LLM in <50 lines of Python

#19

Earlier quoted context omitted.

The latter is strictly superior to the former though. RlHF has been abandoned in the open source world.

Yep, DPO is not technically “RL” and implicitly uses the LLM itself as a reward model, but training with DPO is far more stable for that reason.

I tend to agree @espadrine, it's semantics for the most part

Re: RLHF a LLM in <50 lines of Python

#20
post #2

I don’t understand the obsession of LOC for wrappers - it’s the whole point of a wrapper. It makes it much easier for the user at the expense of making it less hackable Title should be instead “Library for low-code RLHF in python”

This. If I'm the type of person who wants to do RLHF, then I'm the type of person who wants control and doesn't like delegating it to imported libraries.
Post reply on HN