FlagOpen / FlagEmbedding

Retrieval and Retrieval-augmented LLMs
MIT License
6.13k stars 441 forks source link

hugging face上 LLARA-pretrain,LLARA-passage,LLARA- document,LLARA-beir 四个模型有什么区别 #842

Open zhaotl4 opened 1 month ago

zhaotl4 commented 1 month ago

作者您好!最近阅读了贵司的论文“Making Large Language Models A Better Foundation For Dense Retrieval”,论文中写到只使用 MS MARCO 数据去finetune。那么为什么会有四个模型呢?能否介绍一下这四个模型的区别?

hugging face模型链接:https://huggingface.co/BAAI/LLARA-pretrain

545999961 commented 1 month ago

LLARA-pertrain是预训练完的llara LLARA-passage和LLARA-beir是经过msmarco passage微调的llara LLARA-document是经过msmarco document微调的llara

zhaotl4 commented 1 month ago

LLARA-pertrain是预训练完的llara LLARA-passage和LLARA-beir是经过msmarco passage微调的llara LLARA-document是经过msmarco document微调的llara

感谢作者的回复,请问LLARA-passage和LLARA-beir有什么区别呢?论文里说到经过msmarco passage微调的llara,直接去做beir的测评,为什么还会有LLARA-beir这个模型呢?

545999961 commented 1 month ago

LLARA-pertrain是预训练完的llara LLARA-passage和LLARA-beir是经过msmarco passage微调的llara LLARA-document是经过msmarco document微调的llara

感谢作者的回复,请问LLARA-passage和LLARA-beir有什么区别呢?论文里说到经过msmarco passage微调的llara,直接去做beir的测评,为什么还会有LLARA-beir这个模型呢?

它们都经过了 MS MARCO Passage 微调,一个用于 Passage 评测,另一个用于 BEIR 评测。两者的 hard negative 来源不同:LLARA-Passage 的 hard negative 是用现有的dense retriever从top-200里随机sample的,而 LLARA-BEIR 的 hard negative 则来自官方的bm25 hard negative。

zhaotl4 commented 1 month ago

LLARA-pertrain是预训练完的llara LLARA-passage和LLARA-beir是经过msmarco passage微调的llara LLARA-document是经过msmarco document微调的llara

感谢作者的回复,请问LLARA-passage和LLARA-beir有什么区别呢?论文里说到经过msmarco passage微调的llara,直接去做beir的测评,为什么还会有LLARA-beir这个模型呢?

它们都经过了 MS MARCO Passage 微调,一个用于 Passage 评测,另一个用于 BEIR 评测。两者的 hard negative 来源不同:LLARA-Passage 的 hard negative 是用现有的dense retriever从top-200里随机sample的,而 LLARA-BEIR 的 hard negative 则来自官方的bm25 hard negative。

LLARA-pertrain是预训练完的llara LLARA-passage和LLARA-beir是经过msmarco passage微调的llara LLARA-document是经过msmarco document微调的llara

感谢作者的回复,请问LLARA-passage和LLARA-beir有什么区别呢?论文里说到经过msmarco passage微调的llara,直接去做beir的测评,为什么还会有LLARA-beir这个模型呢?

它们都经过了 MS MARCO Passage 微调,一个用于 Passage 评测,另一个用于 BEIR 评测。两者的 hard negative 来源不同:LLARA-Passage 的 hard negative 是用现有的dense retriever从top-200里随机sample的,而 LLARA-BEIR 的 hard negative 则来自官方的bm25 hard negative。

感谢作者的回复,我们在使用llara-pretrain按照repllama去微调后,ms marco 只有36.8,能否请作者告知微调的超参数等信息,我们使用了如下的参数和配置文件: 环境:8x A100 80G,transformers==4.39.2,pytorch==2.1.2,deepspeed==0.12.6,cuda==11.8

超参数

num_train_epochs: 1
learning_rate: 1e-4
warmup_steps: 100
logging_steps: 20
save_steps: 100
per_device_train_batch_size: 50
q_max_len: 128
d_max_len: 192
normalize: True
temperature: 0.01
bf16: true
gradient_checkpointing: True
grad_cache: False
seed: 42
neg_per_ins: 15
negatives_x_device: True

Lora config

peft_config = LoraConfig(
    task_type="FEATURE_EXTRACTION",
    r=32,
    lora_alpha=64,
    lora_dropout=0.1,
    target_modules=["q_proj", "v_proj", "o_proj", "down_proj", "up_proj", "gate_proj"],
    inference_mode=False
)

Deepspeed config

{
    "fp16": {
        "enabled": "auto",
        "loss_scale": 0,
        "loss_scale_window": 1000,
        "initial_scale_power": 2,
        "hysteresis": 12,
        "min_loss_scale": 1
    },
    "optimizer": {
        "type": "AdamW",
        "params": {
            "lr": "auto",
            "betas": "auto",
            "eps": "auto",
            "weight_decay": "auto"
        }
    },
    "scheduler": {
        "type": "WarmupDecayLR",
        "params": {
            "warmup_min_lr": "auto",
            "warmup_max_lr": "auto",
            "warmup_num_steps": "auto",
            "total_num_steps": "auto"
        }
    },
    "zero_optimization": {
        "stage": 1,
        "overlap_comm": true,
        "contiguous_gradients": false,
        "reduce_bucket_size": 20
    },
    "gradient_accumulation_steps": "auto",
    "gradient_clipping": "auto",
    "steps_per_print": 2000,
    "train_batch_size": "auto",
    "train_micro_batch_size_per_gpu": "auto",
    "wall_clock_breakdown": false
}
545999961 commented 1 month ago

一些不同:

learning_rate: 3e-4
warmup_ratio: 0.1
per_device_train_batch_size: 16
q_max_len: 64
d_max_len: 160
bf16: false
fp16: true
r=64,
lora_alpha=16,

同时注意微调的时候需要参照示例的embedding输出方式