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

Require text output feature for LLM finetuning #3493

Merged
merged 1 commit into from
Aug 2, 2023
Merged

Conversation

arnavgarg1
Copy link
Contributor

No description provided.

@arnavgarg1 arnavgarg1 changed the title Add validation check to ensure output feature is a text feature when finetuning LLMs Require text output feature for LLM finetuning Aug 2, 2023
Copy link
Collaborator

@connor-mccorm connor-mccorm left a comment

Choose a reason for hiding this comment

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

Just a thought, in the future, I feel like it may make sense to do some sort of casting behind the scenes for the user when they select category for a fine-tuning job since it seems a little clunky to be restricted to text, even though the task may be binary or multi-class classification.

Aside from that thought, LGTM!

ludwig/config_validation/checks.py Show resolved Hide resolved
@arnavgarg1
Copy link
Contributor Author

arnavgarg1 commented Aug 2, 2023

Just a thought, in the future, I feel like it may make sense to do some sort of casting behind the scenes for the user when they select category for a fine-tuning job since it seems a little clunky to be restricted to text, even though the task may be binary or multi-class classification.

Hmm, so the way fine-tuning works is that a lot of these LLMs are encoder-decoder models, so we're just updating weights within the model architecture itself (either through full fine-tuning, or by inserting new layers through a PEFT adapter), which is why the input and output pairs need to be text-based because that's how it produces the right set of logits. However, if the LLM was an encoder-only LLM, then yeah in theory we could totally support category/binary output feature types because we can stack on a few layers (like a classification head or regression head) that could be fine-tuned. As it stands today, I think just doing text-to-text even for binary of multi-class classification by using a text-to-text model should be totally fine, and it is the recommended approach in the LLM community from what I know.

@tgaddair
Copy link
Collaborator

tgaddair commented Aug 2, 2023

@arnavgarg1 I agree with @connor-mccorm here, and this is what I imagined was happening. Basically, we would still treat it as a text-to-text problem under the hood, but just where the loss is computed on exact match to the generated text. Does that make sense?

@arnavgarg1
Copy link
Contributor Author

Basically, we would still treat it as a text-to-text problem under the hood, but just where the loss is computed on exact match to the generated text. Does that make sense?

It makes sense to me, but atm it's not supported with the current implementation so we would need to build that in. Should be fairly straightforward to do if this is something we want to support

@github-actions
Copy link

github-actions bot commented Aug 2, 2023

Unit Test Results

  6 files  ±0    6 suites  ±0   1h 5m 53s ⏱️ +38s
34 tests ±0  29 ✔️ ±0    5 💤 ±0  0 ±0 
88 runs  ±0  72 ✔️ ±0  16 💤 ±0  0 ±0 

Results for commit a064680. ± Comparison against base commit 734156b.

@arnavgarg1 arnavgarg1 merged commit 3ec5e11 into master Aug 2, 2023
16 checks passed
@arnavgarg1 arnavgarg1 deleted the llm_validation branch August 2, 2023 19:13
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.

None yet

3 participants