Grimoire
1.0.0
英語| 中文簡體
使用Grimoires增強小語言模型的功能。
文化學習(ICL)是通過提供一組幾個彈奏的問答示例來增強大語模型在特定任務上的性能的關鍵方法之一。但是,不同類型的模型的ICL能力由於模型架構,學習數據的數量和參數的大小而顯示出顯著差異。通常,模型的參數大小越大,學習數據越廣泛,其ICL功能就越強。在本文中,我們提出了一種方法(強LLM增強的ICL),該方法involves learning from examples using strong language models and then summarizing and transferring these learned skills to weak language models for inference and application.
這確保了ICL的穩定性和有效性。與直接使弱語言模型從及時的示例中學習相比,Sleicl減少了ICL的難度。我們的實驗在多達五個語言模型的最多八個數據集上進行,這表明弱語言模型使用Sleicl方法對自己的零射擊或幾次射擊功能進行了一致的改進。一些薄弱的語言模型甚至超過了借助Sleicl的GPT4-1106-Preiview(零射)的性能。

該項目分為幾個關鍵目錄和模塊。這是項目結構的概述:
.
├── archived # Store the grimoire and hard samples used in our experiment.
├── assets # Store project assets, such as images, diagrams, or any visual elements used to enhance the presentation and understanding of the project.
├── configs # Store configuration files.
├── core # Core codebase.
│ ├── data # Data processing module.
│ ├── evaluator # Evaluator module.
│ └── llm # Load Large Language Models (LLMs) module.
├── data # Store datasets and data processing scripts.
├── external # Store the Grimoire Ranking model based on the classifier approach.
├── outputs # Store experiment output files.
├── prompts # Store text files used as prompts when interacting with LLMs.
├── stats # Store experiment statistical results.
└── tests # Store test code or unit tests.
克隆存儲庫。
git clone https://github.com/IAAR-Shanghai/Grimoire.git && cd Grimoire為康達環境做準備。
conda create -n grimoire python=3.8.18conda activate grimoire安裝Python依賴關係並處理數據。
chmod +x setup.sh./setup.sh配置
cp -r ./archived/.cache ./ 。查看實驗。查看如何運行實驗。
運行Analyst.py以分析保存在outputs中的結果。
注意:關於LLMS的部署,我們還提供了一些參考教程。


對於任何疑問,反饋或建議,請打開GitHub問題。您可以通過GitHub問題與您聯繫。
setup.sh以實現Python依賴性安裝,並實現embed.py和compute_similarity.py ; huggingface加載大型型號; experiment.yaml中添加可配置的項目。 @article{Grimoire,
title={Grimoire is All You Need for Enhancing Large Language Models},
author={Ding Chen and Shichao Song and Qingchen Yu and Zhiyu Li and Wenjin Wang and Feiyu Xiong and Bo Tang},
journal={arXiv preprint arXiv:2401.03385},
year={2024},
}