概述
它提供了一种灵活的方式来展示任务或格式,但结果取决于模型和提示词,而不是保证有学习阈值。
深入探讨
Ordinary fine-tuning updates a model's parameters through training. In-context learning instead puts information and demonstrations into the input supplied at inference. The model's weights remain fixed while its internal activations and predictions depend on that input. A zero-shot prompt gives no task demonstrations, a one-shot prompt gives one, and a few-shot prompt gives several. For example, demonstrations can show support messages paired with the labels refund and billing; a new message can then be presented using the same structure. The examples suggest the desired pattern without guaranteeing a correct classification. The GPT-3 paper evaluated task demonstrations supplied through text without gradient updates and reported improvements with scale across many tasks. That evidence does not establish a universal one-hundred-billion-parameter threshold below which in-context learning is impossible. Prompt design also matters. Lu and colleagues demonstrated sensitivity to the order of few-shot examples in their evaluated classification settings, so reordering identical examples can change results without changing model weights. Demonstrations can illustrate a format or task relationship, but they are still input tokens that must be processed. Adding more examples uses more of the supported context budget and can increase per-request work; it is not automatically a quality improvement. For a stable application, compare prompting and fine-tuning using task quality, training effort, request costs, and maintenance needs instead of assuming one method is always cheaper.
现实世界的实施
为聊天机器人提供三个示例支持票证及其类别,然后让它以相同的方式对新票证进行分类
显示一个模型,前后两对混乱的文本被重新格式化为干净的 JSON,以便它转换其余的文本
以您的品牌基调粘贴一些示例产品描述,以便新产品与风格相匹配
逐步演示棘手的数学单词问题,以便模型使用相同的推理格式解决类似的问题
情境学习的未来
更大的支持上下文使得提供更多示例成为可能,但也带来了关于相关性和请求成本的选择问题。检索可以帮助选择适合当前任务的示例。在不同的提示词设计下评估相同的代表性请求,并在相关时将这些结果与微调后的替代方案进行比较。一份有用的报告应说明模型、示例、排序和评估任务。更长的提示词长度是一种资源选择,而非学习保证,少样本行为仍然需要对留出输入进行检查。
付诸实践
为什么这很重要
- 速度与规模. 语言工作流程可以在不牺牲一致性的情况下更快地移动。
- 交通与覆盖范围. 它扩展了跨语言和沟通方式的访问。
- 更清晰的判决. 团队可以花更多时间进行判断,而自动化则可以处理重复。
留意
- 幻觉的事实可以悄悄地进入报告、支持流程或研究成果。
- 及时的敏感性可能会在类似的请求中产生不一致的结果。
- 如果访问控制薄弱,敏感文本数据可能会暴露。
后续步骤
- 在推出之前定义输出格式、语气和质量标准。
- 当准确性很重要时,请使用可信来源进行地面响应。
- 为高风险输出保留人工审查检查点。
- 跟踪故障模式并定期重新训练提示或工作流程。
不断探索
常见问题
什么是情境学习?
上下文学习(In-context learning)利用提示词中的信息或演示来调整语言模型的响应,而无需更新其权重。它提供了一种灵活的方式来展示任务或格式,但结果取决于模型和提示词,而不是一个确定的学习阈值。
在情境学习过程中模型内部发生了什么根本变化?
情境学习完全发生在推理中。提示中的示例塑造了模型的激活和下一个标记预测,但没有更新权重。
GPT-3 报告的少样本性能随规模提升这一发现确立了什么?
该研究报告的是任务和模型结果,而非上下文行为的通用参数阈值。
归纳头(induction-head)研究应如何与广泛的上下文学习联系起来?
引用的研究将小型纯注意力模型中更强的发现与更广泛的初步或间接证据区分开来。
应用程序应如何比较重复的少样本提示与微调?
稳定的高频使用可以促使进行比较,但成本和质量取决于实际的设置。
一个少样本工单提示仅展示了退款和账单标签。这些示例为下一个工单提供了什么?
演示展示了期望的输入-输出模式,但正确性仍需评估。