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},
}