FlagEmbedding icon indicating copy to clipboard operation
FlagEmbedding copied to clipboard

finetune instruction for bge rerank

Open QuangTQV opened this issue 1 year ago • 5 comments

Can BGE rerank be finetuned in an instruction style, for example: "tool": { "query": "Transform this user request for fetching helpful tool descriptions: ", "key": "Transform this tool description for retrieval: " }

QuangTQV avatar Apr 16 '24 09:04 QuangTQV

Yes. You need to add this instruction to your data before fine-tuning.

staoxiao avatar Apr 16 '24 15:04 staoxiao

Yes. You need to add this instruction to your data before fine-tuning.

I don't know how to add instructions, and I've also searched for documentation on finetuning BGE rerank but couldn't find any cases with instructions. Can you guide me? I want to rerank for retrieving tools.

QuangTQV avatar Apr 16 '24 16:04 QuangTQV

Hi, @Lahaina936 , if you just want to reranking tools, you can fine-tune using your data without adding instruction. Instruction is only useful when the model needs to perform multiple different tasks. You can add the instruction to the query when generating fine-tuning data {"query": "Find a helpful tool to address the user's issue: xxxxxxx", "pos": List[str], "neg":List[str]}

staoxiao avatar Apr 17 '24 12:04 staoxiao

Hi, @Lahaina936 , if you just want to reranking tools, you can fine-tune using your data without adding instruction. Instruction is only useful when the model needs to perform multiple different tasks. You can add the instruction to the query when generating fine-tuning data {"query": "Find a helpful tool to address the user's issue: xxxxxxx", "pos": List[str], "neg":List[str]}

So if I want to finetune BGE rerank for multiple different tasks like llm-embedder, how should I 'finetune instruction'? Thank you and looking forward to your response.

QuangTQV avatar Apr 17 '24 14:04 QuangTQV

Add different instructions to queries from different tasks. You should organize your data likes {"query": "task-specific instruction: task query", "pos": List[str], "neg":List[str]}

staoxiao avatar Apr 17 '24 17:04 staoxiao