🚀 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許可證。