🚀 Cappy-Large
Cappy是一个预训练的小型评分器,旨在提升多任务大语言模型(LLM)的性能和效率。它能根据指令对候选回复进行评分,以此评估回复的正确性。仅3.6亿参数的Cappy,既可以独立完成分类任务,也能作为辅助组件提升LLM的性能。此外,它还能在不微调LLM或访问其参数的情况下,高效整合下游监督信号。同时,Cappy还能与其他LLM适配方法(如微调、上下文学习和提示调优等)灵活协作,进一步提升性能。
🚀 快速开始
Cappy是一个预训练的小型评分器,旨在提升多任务大语言模型(LLM)的性能和效率。它接收指令和候选回复作为输入,输出一个0到1之间的分数,用于表示回复相对于指令的预估正确性。仅3.6亿参数的Cappy,既可以独立用于分类任务,也可以作为大语言模型(LLM)的辅助组件,提升其性能。此外,Cappy能够在无需微调LLM或访问其参数的情况下,高效整合下游监督信号。而且,Cappy可以灵活地与其他LLM适配方法(包括微调、上下文学习和提示调优等)协作,进一步提升性能。
💻 使用示例
基础用法
Cappy可以加载为Jax/Flax模型或PyTorch模型。
Jax/Flax
from transformers import AutoTokenizer, FlaxAutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained('btan2/cappy-large')
cappy = FlaxAutoModelForSequenceClassification.from_pretrained('btan2/cappy-large')
instruction = """
What label best describes this news article?
Carlyle Looks Toward Commercial Aerospace (Reuters) Reuters - Private investment firm Carlyle Group,\which has a reputation for making well-timed and occasionally\controversial plays in the defense industry, has quietly placed\its bets on another part of the market.
"""
response = 'Business'
inputs = tokenizer([(instruction, response), ], return_tensors='pt')
score = cappy(**inputs).logits[0][0].item()
PyTorch
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained('btan2/cappy-large')
cappy = AutoModelForSequenceClassification.from_pretrained('btan2/cappy-large')
instruction = """
What label best describes this news article?
Carlyle Looks Toward Commercial Aerospace (Reuters) Reuters - Private investment firm Carlyle Group,\which has a reputation for making well-timed and occasionally\controversial plays in the defense industry, has quietly placed\its bets on another part of the market.
"""
response = 'Business'
inputs = tokenizer([(instruction, response), ], return_tensors='pt')
score = cappy(**inputs).logits[0][0].item()
📚 详细文档
评估
我们通过一系列与预训练任务不同的保留任务对Cappy进行了验证。整体性能如图1和图2所示。具体而言,在从PromptSource选取的11个语言理解任务中,仅有3.6亿参数的Cappy显著优于OPT - IML - 30B和OPT - 175B,并达到了此前多任务大语言模型中的最佳水平。此外,在来自BIG - Bench的45个不同复杂任务中,Cappy大幅提升了先进多任务大语言模型FLAN - T5的性能。而且,当与微调或上下文学习结合使用时,Cappy还能进一步提升性能。后续的消融实验证明了我们提出的预训练和数据增强策略的重要性。

软件依赖
Cappy的预训练使用了Red Coast(一个用于自动化分布式训练的轻量级工具包)中此示例的代码。
引用信息
@inproceedings{
tan2023cappy,
title={Cappy: Outperforming and Boosting Large Multi-Task {LM}s with a Small Scorer},
author={Bowen Tan and Yun Zhu and Lijuan Liu and Eric Xing and Zhiting Hu and Jindong Chen},
booktitle={Thirty-seventh Conference on Neural Information Processing Systems},
year={2023},
url={https://openreview.net/forum?id=Srt1hhQgqa}
}

📄 许可证
本项目采用Apache-2.0许可证。