News for hackers. Stuff that matters.

patelajay285

Re:BERTs Are Generative In-Context Learners on Thursday November 14, 2024 @01:02PM (#42139092)
When you train bidirectionally only, you don't get a generative model, that would be the downside. However, you can train on a mixture of causal and bidirectional objectives as some LLM pre-training has done. As far as I am aware, there are no downsides of that, but it is not more common simply because the standard practice has been to train causal only and there just isn't enough funding/attention to go into experimenting on every axis of pre-training (which can be very expensive).
Re:BERTs Are Generative In-Context Learners on Thursday November 14, 2024 @08:09AM (#42135838)
It's not at all expected. T5 models are not generative models by default and they were not thought to be able to perform generation, let alone in-context learning. Remember these models were released before any of the existing LLMs and in-context learning/prompting as a technique became popularized with GPT-3.

While the technique requires multiple samples to coax generations from this particular model, other LLM training schemes have incorporated both unidirectional and bidirectional objectives in their training now. However, this exploration hasn't been fully resolved as most models are still trained only on the causal objective by standard practice. There's still a a lot of exploration that can be done on pre-training objectives.

Re:BERTs Are Generative In-Context Learners on Thursday November 14, 2024 @07:48AM (#42135699)
We found the same result a few years ago in our ICLR paper: https://arxiv.org/pdf/2209.14500

We found Google's T5 models which were released in 2019, pre-GPT-3, were "secretly" capable of in-context learning with a simple inference technique.

Given they use a bidirectional MLM (Masked Language Modeling) objective, it wasn't obvious how to do it, but MLM objectives are known to produce better language representations than causal (next token prediction) objectives. We were able to outperform much larger sized GPT-3 models or get very close to their performance with far smaller T5 models.

Re:Model Distillation in the API on Thursday October 31, 2024 @02:04PM (#42009589)
We've been working on a Python framework where one of the use cases is easy distillation from larger models to smaller open-source models and smaller-closed source models (where you don't have to still use / pay for the closed-source API service): https://datadreamer.dev/docs/latest/

Here's an (now slightly outdated) example of OpenAI GPT-4 => OpenAI GPT-3.5: https://datadreamer.dev/docs/latest/pages/get_started/quick_...

But you can also do GPT-4 to any model on HuggingFace. Or something like Llama-70B to Llama-1B.

For some tasks, this kind of distillation works extremely well given even a few hundred examples of the larger model performing the task.

Re:RLHF a LLM in <50 lines of Python on Sunday February 11, 2024 @07:41PM (#39340283)
Thanks for clarifying, for the record, I generally agree with you. I think we just disagree on the snippets and how in-depth they need to be. Our library is built on HF libraries (we don't implement the training code ourselves), which are popular and commonly utilized by researchers, and people know how to build good models on those libraries. The package is simply meant to provide an easier interface to create some of these complex multi-stage LLM workflows that are starting to become common at ML research conferences and reduce boilerplate code around common functions (caching or tokenizing).

But I hear you on it would be useful to also have some examples that show a proper, reliable model being trained with the library v.s. just example models. The project is pretty early, and we'll work on adding more examples.

Re:RLHF a LLM in <50 lines of Python on Sunday February 11, 2024 @06:19PM (#39339818)
I think you're interpreting hostility where there is none, so I don't have much to say other than it's an infrastructure library, a demonstration snippet doesn't need to show how to train a production grade model. I appreciate the feedback and it's noted.
Re:RLHF a LLM in <50 lines of Python on Sunday February 11, 2024 @05:30PM (#39339423)
It's a demo snippet of how to setup the workflow, it's not meant to be a working production example a self-rewarding model or a faithful reproduction of the original paper. Whether self-rewarding LLMs are a good idea or not, it's a valuable and very active area of research in the literature today. This is a library for ML researchers who should actively research and study these avenues along with the pitfalls you're mentioning. But in order for them to do that, building these workflows have to be accessible to them, which is what this library is meant to do. It's not meant for the "hobbyist" ML-community, they should not be using synthetic data today in this way, it would likely lead to subpar results for any practical model or task.
Re:RLHF a LLM in <50 lines of Python on Sunday February 11, 2024 @04:42PM (#39339053)
Collecting data is hard, but the library is also a synthetic data generation library, so for example you can create the data for DPO fully synthetically, check out the self-rewarding LLMs example: https://datadreamer.dev/docs/latest/pages/get_started/quick_...
Re:RLHF a LLM in <50 lines of Python on Sunday February 11, 2024 @04:39PM (#39339031)
Yes it is :), but the library is also a synthetic data generation library, so for example you can create the data for DPO fully synthetically, check out the self-rewarding LLMs example:

https://datadreamer.dev/docs/latest/pages/get_started/quick_...

Re:RLHF a LLM in <50 lines of Python on Sunday February 11, 2024 @01:39PM (#39337291)
That's totally fair and good feedback, it's hard to support everyone's use cases simultaneously, but from my own research and other researchers we collaborate with, this solves and streamlines the right set of problems, but we want to make this as broadly useful as possible. Always happy to chat more / provide support if you would like, feel free to reach out if you want to try it and run into any sharp edges I could help make easier.
Re:RLHF a LLM in <50 lines of Python on Sunday February 11, 2024 @01:24PM (#39337107)
I think the discussion in the other comment thread discusses this well. They are different techniques, but the line between RL & SL is quite fuzzy. The DPO authors advertise this as a "non-RL" technique to precisely get away from the reputation of unstable training RL has, but they also say and treat the language model as an (implicit) reward model, similar to PPO. The point is well taken though, I will update this page to clarify the differences to avoid confusion.
Re:RLHF a LLM in <50 lines of Python on Sunday February 11, 2024 @12:58PM (#39336870)
Thanks for the question. This is built for ML researchers, so in examples we use the defacto source for datasets researchers often use, HF Hub.

However, there is a lot of documentation on the site to help guide users. This documentation page shows you can load in data via local datasets as well. For example, JSON, CSV, text files, a local HF Dataset folder, or even from a Python `dict` or `list`:

https://datadreamer.dev/docs/latest/datadreamer.steps.html#t...

We'll definitely keep improving documentation, guides, and examples. We have a lot of it already, and more to come! This has only recently become a public project :)

If anyone has any questions on using it, feel free to email me directly (email on the site and HN bio) for help in the meantime.

Re:RLHF a LLM in <50 lines of Python on Sunday February 11, 2024 @12:26PM (#39336593)
This was discussed in another comment, DPO is pretty much strictly better than RLHF + PPO, and far more stable when training. Yes, DPO is not technically "RL", but it's semantics for the most part. DataDreamer does support PPO training if you want, but it's so unstable, it's a less popular choice now.
Re:RLHF a LLM in <50 lines of Python on Sunday February 11, 2024 @11:42AM (#39336183)
This is built for ML researchers out of an academic lab. There's a ton of functionality in the library (beyond RLHF and alignment) that ML researchers do every day to write papers and run experiments that the library helps abstract and make repeatable and usable.

Unless your research hypothesis is specifically around improving or changing RLHF, it's unlikely you should be implementing it from scratch. Abstractions are useful for a reason. The library is quite configurable to let you tune any knobs you would want.

Re:RLHF a LLM in <50 lines of Python on Sunday February 11, 2024 @11:16AM (#39336009)
I tend to agree @espadrine, it's semantics for the most part
Re:RLHF a LLM in <50 lines of Python on Sunday February 11, 2024 @11:03AM (#39335897)
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 on Sunday February 11, 2024 @11:02AM (#39335887)
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 on Sunday February 11, 2024 @11:00AM (#39335873)
Thanks, appreciate the feedback, will update when I get a chance!
Re:RLHF a LLM in <50 lines of Python on Sunday February 11, 2024 @11:00AM (#39335871)
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 on Sunday February 11, 2024 @10:59AM (#39335858)
Fair, DPO is considered a fairly well established technique now that is far more stable in training than PPO, but also helps align LLMs from human feedback. The package also helps do PPO, so you can do traditional RLHF, but figured more people would be interested in seeing a DPO example, given how unstable PPO is.
Re:RLHF a LLM in <50 lines of Python on Sunday February 11, 2024 @10:51AM (#39335805)
Appreciate the feedback on the title, this is developed for ML researchers, so I assure there is a lot it’s doing under the hood to make this process easier (for example introducing automatic caching and resumability).

However, we also tried to simplify the API and have sensible defaults to make it usable for anyone / make ML research code cleaner :)

Re:RLHF a LLM in <50 lines of Python on Sunday February 11, 2024 @10:47AM (#39335771)
This is developed for researchers, so I assure it’s very hackable and configurable. ;-) but appreciate the feedback on the title!
Re:RLHF a LLM in <50 lines of Python on Sunday February 11, 2024 @10:46AM (#39335766)
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

Re:Distill OpenAI GPT-4 to a cheaper, faster GPT-3.5 model on Sunday February 11, 2024 @10:10AM (#39335498)
We are planning to expand this in the future! Thanks for the feedback
Re:Ollama releases OpenAI API compatibility on Thursday February 08, 2024 @04:08PM (#39307728)
We've been working on a project that provides this sort of easy swapping between open source (via HF, VLLM) & commercial models (OpenAI, Google, Anthropic, Together) in Python: https://github.com/datadreamer-dev/DataDreamer

It's a little bit easier to use if you want to do this without an HTTP API, directly in Python.

Re:Ask HN: What have you built with LLMs? on Monday February 05, 2024 @01:37PM (#39264997)
We've built a prompting, synthetic data generation, and training library called DataDreamer: https://github.com/datadreamer-dev/DataDreamer
Re:Pgvector – vector similarity search for Postgres on Thursday April 22, 2021 @03:09PM (#26906833)
Check out Magnitude, we built it to solve that problem: https://github.com/plasticityai/magnitude

It's still loaded from a file, but heavily uses memory-mapping and caching to be speedy and not overload your RAM immediately. And in production scenarios, multiple worker processes can share that memory due to the memory mapping.

Granted it's read-only, so might not be exactly what you are looking for.

Disclaimer: I'm the author.

Older »