用多个提示词批量生成,提升大模型输出质量。
M-Ped: Multi-Prompt Ensemble Decoding for Large Language Models
- 同一输入生成多个提示词,批量解码取概率平均。
- 在机器翻译等任务上,BLEU、pass@k等指标显著提升。
- 适合追求高精度生成的场景,如代码生成与文本简化。
随着大语言模型(LLMs)在自然语言处理领域的广泛应用,提升其性能成为研究热点。本文提出一种新型多提示词集成解码方法,通过聚合多个提示词的输出结果来增强LLM的生成质量。给定唯一输入 $X$,我们以批量模式提交 $n$ 种变体提示词包含 $X$ 给LLM进行解码,获得各词元的概率分布。对于每个词元预测,通过平均批次内 $n$ 个概率分布计算集成概率,并据此生成词元,该技术称为内部批处理集成。为支持高效批量推理,采用左填充策略保持 $n$ 个提示词的输入长度一致。在机器翻译、代码生成和文本简化等多种NLP任务上的大量实验表明,该方法在BLEU分数、pass@$k$率和LENS指标上均显著优于传统方法。
原文摘要 · Abstract (English)
With the widespread application of Large Language Models (LLMs) in the field of Natural Language Processing (NLP), enhancing their performance has become a research hotspot. This paper presents a novel multi-prompt ensemble decoding approach designed to bolster the generation quality of LLMs by leveraging the aggregation of outcomes from multiple prompts. Given a unique input $X$, we submit $n$ variations of prompts with $X$ to LLMs in batch mode to decode and derive probability distributions. For each token prediction, we calculate the ensemble probability by averaging the $n$ probability distributions within the batch, utilizing this aggregated probability to generate the token. This technique is dubbed Inner-Batch Ensemble. To facilitate efficient batch inference, we implement a Left-Padding strategy to maintain uniform input lengths across the n prompts. Through extensive experimentation on diverse NLP tasks, including machine translation, code generation, and text simplification, we demonstrate the efficacy of our method in enhancing LLM performance. The results show substantial improvements in BLEU scores, pass@$k$ rates, and LENS metrics over conventional methods.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。