Mindspore 公开课 - prompt

prompt 介绍

Fine-Tuning to Prompt Learning
Pre-train, Fine-tune
  1. BERT
  • bidirectional transformer,词语和句子级别的特征抽取,注重文本理解
  • Pre-train: Maked Language Model + Next Sentence Prediction
  • Fine-tune: 根据任务选取对应的representation(最后一层hidden state输出),放入线性层中

例:Natural Language Inference

Pre-train, Fine-tune: models
  1. BERT
    • bidirectional transformer,词语和句子级别的特征抽取,注重文本理解
    • Pre-train: Maked Language Model + Next Sentence Prediction
    • Fine-tune: 根据任务选取对应的representation(最后一层hidden state输出),放入线性层中
      例:Named Entity Recognition
Pre-train, Fine-tune: models
  1. GPT
    • auto-regressive model,通过前序文本预测下一词汇,注重文本生成
    • Pre-train: L 1 ( U ) = ∑ i log ⁡ P ( u i ∣ u i − k , ... , u i − 1 ; Θ ) L_1(\mathcal{U})=\sum_i \log P\left(u_i \mid u_{i-k}, \ldots, u_{i-1} ; \Theta\right) L1(U)=∑ilogP(ui∣ui−k,...,ui−1;Θ)
    • Fine-tune: task-specific input transformations + fully-connected layer
Pre-train, Fine-tune: challenges
  1. gap between pre-train and fine-tune

少样本学习能力差、容易过拟合

Pre-train, Fine-tune: challenges
  1. gap between pre-train and fine-tune

少样本学习能力差、容易过拟合

Pre-train, Fine-tune: challenges
  1. cost of fine-tune

现在的预训练模型参数量越来越大,为了一个特定的任务去 finetuning 一个模型,然后部署于线上业务,也会造成部署资源的极大浪费

Pre-train, Prompt, Predict: what is prompting

  • fine-tuning: 通过改变模型结构,使模型适配下游任务
  • prompt learning: 模型结构不变,通过重构任务描述,使下游任务适配模型
Pre-train, Prompt, Predict: workflow of prompting
Pre-train, Prompt, Predict: workflow of prompting
  1. Template: 根据任务设计prompt模板,其中包含 input slot[X] 和 answer slot [Z],后根据模板在 input slot 中填入输入
  2. Mapping (Verbalizer): 将输出的预测结果映射回label
Pre-train, Prompt, Predict: prompt design

Prompting 中最主要的两个部分为 template 与 verbalizer 的设计。

他们可以分别基于任务类型和预训练模型选择(shape)或生成方式(huamn effort)进行分类。

相关推荐
easy_coder2 小时前
《工程化视角下的Prompt设计与迭代:云诊断与CICD变更风控中的实践》
人工智能·云计算·prompt
码点滴4 小时前
上下文压缩不是“丢数据“:Context Compressor 的血缘追踪与 Prefix Cache 保护
人工智能·python·架构·prompt·ai编程
Generalzy7 小时前
用 prompt_toolkit + Rich 打造一个现代终端应用
prompt
AI木马人16 小时前
3.【Prompt工程实战】如何设计一个可复用的Prompt系统?(避免每次手写提示词)
linux·服务器·人工智能·深度学习·prompt
胡利光1 天前
Harness Engineering 01|从 Prompt Engineering 到 Harness Engineering
prompt
干洋芋果果2 天前
AI念咒_浏览器测试自动化
prompt
qcx232 天前
【解构】DeepSeek V4 发布:技术报告深度解读 + 横向对比六大开源模型,我们的判断是……
人工智能·chatgpt·prompt
蓝色的音乐2 天前
GPT Image 2 提示词怎么写?分享一个 400+ 案例 Prompt Gallery
gpt·prompt
迦南的迦 亚索的索2 天前
AI_05_基于Prompt工程的金融行业项目
人工智能·金融·prompt
2501_940041743 天前
AI创建小游戏指令词
人工智能·游戏·prompt