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等先进大语言模型进行特定任务适配具有挑战性。由于其参数、嵌入层乃至输出概率均不透明,现有的微调适配方法无法适用。因此,只能通过API服务来适配这些黑盒大语言模型,这引发了关于透明度、隐私和成本的担忧。为应对这些挑战,我们提出了BBox-Adapter——一种面向黑盒大语言模型的新型轻量化适配器。BBox-Adapter通过将目标域数据视为正样本、源域数据视为负样本,从而区分目标域与源域数据。它采用基于排序的噪声对比估计损失函数,以提升目标域数据的似然概率,同时抑制源域数据的似然。此外,该适配器具备在线适应机制,能够整合来自真实标注、人类反馈或AI反馈的实时正样本采样,并结合先前适配过程中的负样本数据。大量实验证明了BBox-Adapter的有效性与成本效益。该方法在多种任务和领域中最高可提升模型性能6.77%,同时将训练与推理成本分别降低至原来的1/31.30和1/1.84。