FlagEmbedding icon indicating copy to clipboard operation
FlagEmbedding copied to clipboard

BAAI/bge-m3 微调效果差

Open chenyunsai opened this issue 11 months ago • 2 comments

我的场景是rag的召回,尝试训练BAAI/bge-m3

数据集格式是 { query:[query], pos:[pos], neg:[neg1,neg2,neg3....] 【10个】 }

一些关键参数 batchsize 16 perdivce 2 gpu 8 per_device_train_batch_size 1 num_train_epochs 5 temperature 0.01 learning_rate 2e-5 normlized False 计算相似度的方法 cos_similarity

但是训练的效果特别差 ,设置比不训练的版本在测试集上表现还要差,大家有遇到类似的事情么

chenyunsai avatar Mar 23 '24 09:03 chenyunsai

normlized应设置为True,设置为False指的是使用内积作为相似度,设置为True才是使用cos_similarity

staoxiao avatar Mar 23 '24 12:03 staoxiao

normlized应设置为True,设置为False指的是使用内积作为相似度,设置为True才是使用cos_similarity

我在损失函数这块之前把代码改了 self.similarity_fct = nn.CosineSimilarity(dim=-1) def compute_similarity(self, q_reps, p_reps): return self.similarity_fct(q_reps, p_reps) #if len(p_reps.size()) == 2: # return torch.matmul(q_reps, p_reps.transpose(0, 1)) #return torch.matmul(q_reps, p_reps.transpose(-2, -1))

chenyunsai avatar Mar 23 '24 12:03 chenyunsai