Lurker News
I've been playing around with https://github.com/zphang/minimal-llama/ and https://github.com/tloen/alpaca-lora/blob/main/finetune.py, and wanted to create a simple UI where you can just paste text, tweak the parameters, and finetune the model quickly using a modern GPU.

To prepare the data, simply separate your text with two blank lines.
There's an inference tab, so you can test how the tuned model behaves.
This is my first foray into the world of LLM finetuning, Python, Torch, Transformers, LoRA, PEFT, and Gradio.
Enjoy!

Comments (98) 20 threads

Show all comments

Showing thread 7 of 20

holoduke2 replies#
I am really an AI noob. But lets say i tried the 7b model for translations purposes with below acceptable results. Can i train the model with 1 million of translated sentences to improve the quality of the translation output?
Method-X1 reply#
Can you give an example on how you prompted the model? Your issue is probably related to that, but I would need an example to be sure. I've found the 7b Alpaca model [1] to work surprisingly well! Here's how you're supposed to prompt it:

Below is an instruction that describes a task. Write a response that appropriately completes the request.
### Instruction: {instruction}
### Response:
or
Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction: {instruction}
### Input: {input}
### Response:
[1] https://github.com/cocktailpeanut/dalai

lxe#
Barebones llama is just a text completion model. You can give it a prompt like

    A conversation between a human and assistant

    Human: How old is the sun?
    Assistant:
And it will complete it.

Alpaca/Dalai are finetuned on a dataset that's formatted as this:

    ### Instruction: {instruction}

    ### Input: {input}

    ### Response:
So even without pre-prompting in this format it's going to be heavily biased towards performing completions in this format anyways.

It's always helpful to finetune on a preformatted prompt depending on what your task is.

benob2 replies#
Yes you can finetune the model with reference output for any kind of language task. For translation, you are better off starting from a model specifically trained for that purpose such as facebook/nllb-200-distilled-1.3B. It will be faster and more accurate.
wsgeorge2 replies#
> For translation, you are better off starting from a model specifically trained for that purpose

Yes, but wasn't the whole point of the recent LLM research to show that you didn't need to fine-tine for a specific task?

inportb#
You could just use a much bigger model to perform arbitrary tasks without fine-tuning.
Closi#
Sure, but you will get better results at a smaller number of parameters from a specifically trained model right now if you are trying to train/host it yourself.

Remember that GPT3 is 175 billion parameters so many times bigger than both the above models (and gpt4 is rumoured to be bigger still), which also allows it to be more generalisable.
If GPT3 was trained at 7 billion parameters it might also lose it's language translation capabilities.

holoduke#
Do you know any guide on how to train these models? Any thoughts on the hardware requirements?