arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2407.10930cs.CLcs.AIcs.LG
收藏

微调与提示优化:协同增效的两大关键步骤

Fine-Tuning and Prompt Optimization: Two Great Steps that Work Better Together

Stanford University(斯坦福大学)

Dilara Soylu, Christopher Potts, Omar Khattab

AI总结:

针对模块化NLP流水线端到端优化难的问题,提出结合权重与提示优化的BetterTogether策略,交替迭代让LM自我教学,实验显示其效果显著优于单类优化方法。

摘要:

自然语言处理(NLP)系统正越来越多地采用复杂的模块化流水线形式,例如检索增强生成(Retrieval Augmented Generation,RAG),其中每个模块可能涉及不同的语言模型(Language Model,LM)及对应的提示模板。这类复合系统通常缺少中间标签或梯度流来优化每个模块,使其端到端优化颇具挑战。本文旨在探索策略,同时优化这类系统的模块级LM权重与对应提示模板,以最大化下游任务指标。我们首次提出结合权重优化与提示优化策略,通过在两者间交替迭代,让同一LM实现自我教学,以此优化模块化LM流水线。在多跳问答、数学推理以及基于特征的分类任务中,使用mistral-7b、llama-2-7b和llama-3-8b开展实验,结果显示,这类协同优化流水线权重与提示的BetterTogether策略,在所有LM和任务上的平均表现,分别优于仅直接优化权重和仅优化提示的策略最高达60%和6%。BetterTogether优化器已在DSPy中发布,地址为http://dspy.ai。

英文摘要:

Natural Language Processing (NLP) systems are increasingly taking the form of sophisticated modular pipelines, e.g., Retrieval Augmented Generation (RAG), where each module may involve a distinct Language Model (LM) and an associated prompt template. These compound systems often lack intermediate labels or gradient flow to optimize each module, making their end-to-end optimization challenging. Here we seek strategies to optimize both the module-level LM weights and the associated prompt templates of such systems to maximize a downstream task metric. We propose for the first time combining the weight and prompt optimization strategies to optimize a modular LM pipeline by alternating between the two to get the same LM to teach itself. In experiments with multi-hop QA, mathematical reasoning, and feature-based classification using mistral-7b, llama-2-7b, and llama-3-8b, these BetterTogether strategies optimizing the weights and prompts of a pipeline together outperform directly optimizing weights alone and prompts alone by up to 60% and 6%, respectively, on average across LMs and tasks. BetterTogether optimizer is released in DSPy at http://dspy.ai

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑