FlagOpen / FlagEmbedding

Retrieval and Retrieval-augmented LLMs
MIT License
7.02k stars 513 forks source link

Instruction-based Fine-tuning #902

Open QuangTQV opened 3 months ago

QuangTQV commented 3 months ago

I'm writing a thesis, could you share the techniques behind instruction-based fine-tuning? How can it adjust the embeddings based on the instructions, or is it simply adding the instruction string to the sentence to be embedded and training as usual?

staoxiao commented 3 months ago

@QuangTQV , we just added a instruction string to the sentence:https://github.com/FlagOpen/FlagEmbedding/blob/master/FlagEmbedding/baai_general_embedding/finetune/data.py#L43

QuangTQV commented 3 months ago

@QuangTQV , we just added a instruction string to the sentence:https://github.com/FlagOpen/FlagEmbedding/blob/master/FlagEmbedding/baai_general_embedding/finetune/data.py#L43

But how does adding an instruction string during training help the model share knowledge without causing interference between tasks? Is the model designed with a different structure, flexible between tasks?

staoxiao commented 3 months ago

@QuangTQV , we just added a instruction string to the sentence:https://github.com/FlagOpen/FlagEmbedding/blob/master/FlagEmbedding/baai_general_embedding/finetune/data.py#L43

But how does adding an instruction string during training help the model share knowledge without causing interference between tasks? Is the model designed with a different structure, flexible between tasks?

We don't modify any structure. The instruction will influence the last hidden states of all tokens by self-attention module.