Jinkin commited on
Commit
ff2a5ac
1 Parent(s): a6d8dc8

update training details

Browse files
Files changed (1) hide show
  1. README.md +26 -1
README.md CHANGED
@@ -1109,7 +1109,32 @@ scores = q_embeddings @ p_embeddings.T
1109
  ```
1110
 
1111
  ## Training Detail
1112
- TODO
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1113
 
1114
  ## License
1115
  Piccolo 使用 MIT License,免费商用。
 
1109
  ```
1110
 
1111
  ## Training Detail
1112
+ ### pretrain
1113
+
1114
+ pretrain 通常不需要太大的max length, 推荐128。小的max length用以提高batch size,加快训练速度,从而适应大规模数据。
1115
+ pretrain 损失我们采用二元组contrastive loss,不加入hard negative, 直接采用inbatch negative,在实际训练中,我们使用了32张40G A100进行训练,单卡的batch size为1024。
1116
+
1117
+ Pretrain usually does not require a large max length, and 128 is recommended. A small max length is used to increase batch size and speed up training to adapt to large-scale data.
1118
+ We use binary contrastive loss for pretrain loss, without adding hard negative, and directly use inbatch negative. In actual training, we used 32 40G A100 for training, and the batch size of a single card is 1024.
1119
+
1120
+ ### finetune
1121
+ finetune 通常会将 max length扩增到512。用以适应更大长度的文本输入,finetune时会多sample S2P的数据,以增强模型在retrieval任务上的性能。
1122
+ finetune 损失采用三元组contrastive loss,加入hard negative,neg num通常设置为2-7,loss计算方式可以参考GTE里的improved contrastive loss。
1123
+ 注意: 我们给query和passage设置了不同的max length,query的max length始终保持在64。
1124
+
1125
+ For finetuning, we usually expands the max length to 512. To adapt to larger length text input, finetune will sample more S2P data to enhance the performance of the model on retrieval tasks.
1126
+ The finetune loss uses triple contrastive loss, adding hard negative. Neg num is usually set to 2-7. The loss calculation method can refer to the improved contrastive loss in GTE.
1127
+ Note: We set different max lengths for query and passage, and the max length of query is always kept at 64.
1128
+
1129
+ ### Others
1130
+ 1. 减小显存的方式: fp16 + gradient checkpointing + ZERO STAGE1 (stage2 不支持双塔结构下的gradient checkpointing) 相关issue见: https://github.com/microsoft/DeepSpeed/issues/988
1131
+ 2. dataset sampler,我们采用了M3E的dataset sampler,用以保证每个batch里的样本均来自于一个dataset,负样本更有价值。
1132
+ 3. instruction。instruction在我们的实验中对retrieval任务有非常大的性能提升,我们在每个训练样本前都加入'查询: '和'结果: '这样的instruction。
1133
+
1134
+ 1. The way to reduce memory usage: fp16 + gradient checkpointing + ZERO STAGE1 (stage2 does not support gradient checkpointing under the double-tower structure) For related issues, see: https://github.com/microsoft/DeepSpeed/issues/ 988
1135
+ 2. Dataset sampler, we use M3E's dataset sampler to ensure that the samples in each batch come from a dataset, and negative samples are more valuable.
1136
+ 3. instruction. Instruction has greatly improved the performance of the retrieval task in our experiments. We added instructions like 'query: ' and 'result: ' before each training sample.
1137
+
1138
 
1139
  ## License
1140
  Piccolo 使用 MIT License,免费商用。