LoRAHub:Efficient Cross-Task Generalization Dynamic LORA via dynamic LoRA Composition

*LoRAHub:Efficient Cross-Task Generalization Dynamic LORA via dynamic LoRA Composition

Introduction

在微调模型后,LLM从一个只会文字接龙的模型转换到以与人交流的方式输出下一个词。但是我们在处理一些复杂问题是往往还需要在其基础上做ICL+CoT/FewShot,但是这回导致上下文非常长,从成本的角度来讲,这是十分不经济的。

本文提出了LoRAHub,通过多个LoRA模型来共同决策新的下游任务。
在这里插入图片描述

Method

在这里插入图片描述
如上图,作者训练多个需要复杂问题领域的LoRA,用w表示,然后在解决新的问题是,通过考虑之前训练过的所有adapter,上就是上图右侧adapter表示求和。为了更精确的查找,作者为每个adapter都引入特定的权重,这实际上就变成了线性回归公式如下:

在这里插入图片描述
其中AB就是LoRA的增量权重,把这个替换为多个权重的加权和:

在这里插入图片描述
为了减少计算量,作者通过了参数搜索的形势寻找最优参数。

试验结果

在这里插入图片描述
可以看到只用了六分之一的token数就达到了与ICL+few-shot类似的性能。

参考

https://arxiv.org/pdf/2307.13269.pdf

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
Group-wise cross-validation is a type of cross-validation that is used when the data has a group structure. It is a more appropriate approach when the samples are collected from different subjects, experiments, or measurement devices. In group-wise cross-validation, the data is divided into groups, and the validation process is performed on each group separately. This ensures that the model is evaluated on data from different groups, which helps to assess its generalization performance in real-world scenarios. Here is an example of how group-wise cross-validation can be implemented using the K-fold cross-validation technique: ```python from sklearn.model_selection import GroupKFold from sklearn.linear_model import LogisticRegression # Assuming we have features X, labels y, and groups g X = ... y = ... groups = ... # Create a group-wise cross-validation iterator gkf = GroupKFold(n_splits=5) # Initialize a model model = LogisticRegression() # Perform group-wise cross-validation for train_index, test_index in gkf.split(X, y, groups): X_train, X_test = X[train_index], X[test_index] y_train, y_test = y[train_index], y[test_index] # Fit the model on the training data model.fit(X_train, y_train) # Evaluate the model on the test data score = model.score(X_test, y_test) # Print the evaluation score print("Validation score: ", score) ``` In this example, the data is divided into 5 groups using the GroupKFold function. The model is then trained and evaluated on each group separately. The evaluation score for each fold is printed to assess the model's performance.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

HanZee

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值