Extending large language models to effectively handle long contexts requires instruction fine-tuning on input sequences of similar length. To address this, we present LongAlign -- a recipe of the instruction data, training, and evaluation for long context alignment. First, we construct a long instruction-following dataset using Self-Instruct. To ensure the data diversity, it covers a broad range of tasks from various long context sources. Second, we adopt the packing and sorted batching strategies to speed up supervised fine-tuning on data with varied length distributions. Additionally, we develop a loss weighting method to balance the contribution to the loss across different sequences during packing training. Third, we introduce the LongBench-Chat benchmark for evaluating instruction-following capabilities on queries of 10k-100k in length. Experiments show that LongAlign outperforms existing recipes for LLMs in long context tasks by up to 30\%, while also maintaining their proficiency in handling short, generic tasks. The code, data, and long-aligned models are open-sourced at https://github.com/THUDM/LongAlign.
Rensselaer Polytechnic Institute(伦斯勒理工学院);IBM Research(IBM研究院);University of Waterloo(滑铁卢大学);University of Michigan(密歇根大学);MIT-IBM Watson AI Lab(麻省理工学院-IBM沃森人工智能实验室)
The Fragility and Dynamics of LLM Pruning-Recovery Steps
Institute of Information Science, Academia Sinica(中央研究院资讯科学研究所);National Taiwan University of Science and Technology(台湾科技大学);AI Research Center, Hon Hai Research Institute(鸿海研究院人工智能研究中心)
Images & Recipes: Retrieval in the cooking context
Sorbonne Université(索邦大学);ETIS, UMR 8051(ETIS联合研究单位8051);Université Paris Seine(巴黎塞纳大学);Université Cergy-Pontoise(塞吉-蓬图瓦兹大学);ENSEA(法国国立高等电子与应用学院);CNRS(法国国家科学研究中心)
LongForm: Effective Instruction Tuning with Reverse Instructions
Center for Information and Language Processing, LMU Munich(慕尼黑大学信息与语言处理中心);Munich Center for Machine Learning(慕尼黑机器学习中心);Language Technology Lab, University of Cambridge(剑桥大学语言技术实验室)
Segment, Embed, and Align: A Universal Recipe for Aligning Subtitles to Signing
VGG, Dept. of Engineering Science, University of Oxford(视觉感知与计算实验室,工程科学系,牛津大学);University of Zurich(苏黎世大学);KAIST(韩国科学技术院);LIGM, CNRS, Univ Gustave Eiffel, ENPC, IP Paris(LIGM,国家科学研究中心,古斯塔夫·埃菲尔大学,巴黎理工大学,IP巴黎)