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

Is soft prompting enabled or is there a plan to do so? #4885

Closed
robhaslinger opened this issue Jan 12, 2024 · 4 comments
Closed

Is soft prompting enabled or is there a plan to do so? #4885

robhaslinger opened this issue Jan 12, 2024 · 4 comments
Labels
enhancement New feature or request stale

Comments

@robhaslinger
Copy link

Does llama.cpp have (or is it planned to have) the ability to use soft prompts? In principle I think this should be reasonably straightforward as it's just prepending the soft prompt embeddings to the front of the embedded hard prompts. I don't know if the GGUF format quantizes the embedding layer or not ... I suppose that might put a wrinkle in things if so.

Apologies if this is already enabled or if this has been discussed previously, I searched for a while and couldn't find anything. Thanks for your work on this repo, it's amazing.

Cheers Rob

@robhaslinger robhaslinger added the enhancement New feature or request label Jan 12, 2024
@ggerganov
Copy link
Owner

ggerganov commented Jan 12, 2024

I'm not familiar with "soft prompts" but based on your description, you can first submit a llama_batch with the embeddings (use the float * embd; member) and then proceed as usual.

@robhaslinger
Copy link
Author

Basically you add a few 'virtual tokens' at the front of your prompts by initializing random embeddings and then tune those embeddings while keeping the parameters of the base model fixed. Supposedly it gets around the trial and error of writing 'hard' prompts in plain text. There's some discussion here: https://huggingface.co/docs/peft/task_guides/clm-prompt-tuning To be honest I'm not sure how well this works compared with qlora, probably not as well, but I was interested in it as a light weight way of rapidly switching between tasks. I'm also under the impression that the finetuning is a lot quicker than qlora as the number of tunable parameters is far fewer.

Thanks for pointing out that you can directly input embeddings. I do see that there's something about inputing either tokens or embeddings into the llama_batch class. I don't understand the details yet as I'm newer to your code base but I'll hunt through the code and try to figure it out.

Cheers Rob

Copy link
Contributor

This issue is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale label Mar 18, 2024
Copy link
Contributor

github-actions bot commented Apr 3, 2024

This issue was closed because it has been inactive for 14 days since being marked as stale.

@github-actions github-actions bot closed this as completed Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request stale
Projects
None yet
Development

No branches or pull requests

2 participants