Adapting state-of-the-art Large Language Models (LLMs) like GPT-4 and Gemini for specific tasks is challenging. Due to the opacity in their parameters, embeddings, and even output probabilities, existing fine-tuning adaptation methods are inapplicable. Consequently, adapting these black-box LLMs is only possible through their API services, raising concerns about transparency, privacy, and cost. To address these challenges, we introduce BBox-Adapter, a novel lightweight adapter for black-box LLMs. BBox-Adapter distinguishes target and source domain data by treating target data as positive and source data as negative. It employs a ranking-based Noise Contrastive Estimation (NCE) loss to promote the likelihood of target domain data while penalizing that of the source domain. Furthermore, it features an online adaptation mechanism, which incorporates real-time positive data sampling from ground-truth, human, or AI feedback, coupled with negative data from previous adaptations. Extensive experiments demonstrate BBox-Adapter's effectiveness and cost efficiency. It improves model performance by up to 6.77% across diverse tasks and domains, while reducing training and inference costs by 31.30x and 1.84x, respectively.
翻译:针对GPT-4、Gemini等尖端大语言模型(LLMs)的特定任务适配极具挑战性。由于模型参数、嵌入向量乃至输出概率均不透明,现有微调适配方法难以适用。因此,黑盒LLMs仅能通过API服务进行适配,这引发了透明度、隐私保护和成本控制等问题。为解决上述挑战,我们提出BBox-Adapter——一种面向黑盒LLMs的新型轻量级适配器。该方法通过将目标领域数据视为正样本、源领域数据视为负样本,实现领域数据区分。基于排序的噪声对比估计(NCE)损失函数,BBox-Adapter可提升目标领域数据的生成概率,同时抑制源领域数据的生成概率。此外,该方法具备在线适配机制:既能通过真实标注、人工或AI反馈实时采样正样本数据,又能利用历史适配产生的负样本数据。大量实验证明,BBox-Adapter兼具高效性与成本优势。在多种任务与领域场景下,该方法使模型性能最高提升6.77%,同时将训练与推理成本分别降低31.30倍和1.84倍。