Prompting and In Context Learning

#DeepLearning #Prompting #In-ContextLearning

Issues with Fine-Tuning

  • Need large task-specific datasets for fine-tuning 需要大量专业的数据集
  • Train endlessly 不通用
    • Collect data for task , fine-tune model to solve task
    • Collect data for task , fine-tune model to solve task
    • ...
  • Prone to overfitting 容易过拟合
    • Large models adapt to very narrow task distribution, which may exploit spurious correlations
  • Finetuning large models is expensive to time, memory, and cost
How to adapt a pre-trained model without fine-tuning

Prompting

What is Prompting?
  • Prompt-based learning (inference)
  • A new paradigm in Deep Learning / Machine Learning (NLP, CV)
  • Encouraging a pre-trained model to make particular predictions by providing a “prompt” that instructs the model to perform the task effectively

The General workflow of Prompting:

  1. Prompt Addition
  2. Answer Prediction (Search)
  3. Post-process the answer

Prompt Addition

  • Given input , this component modifies the input into a prompt x^'

    • Append a textual string to the input
  • Contains two step

    • Define a template with two slots
      • An input slot for input
      • An answer slot for an intermediate generated answer that will later be mapped into label
    • Fill slot with the input

Answer Prediction

Post-process the answer

Design Considerations for Prompting

  • Pre-trained model choice
  • Prompt engineering
  • Answer engineering
  • Multi-Prompt learning

Pre-trained model choice

Prompt engineering

Answer engineering

Multi-Prompt learning

The Elements of Prompting

A prompt contains any of the following elements

  • Instruction − The description of a specific task that you want the model to perform
  • Context − External information or additional context that can steer the model to better responses
  • Input data − The input or question that we are interested to find a response for
  • Output Indicator − The type or format of the output

Applications of Prompting

  • Text classification
  • Text summarization
  • Information extraction
  • Question Answering
  • Conversation
  • Code generation
  • Reasoning

Techniques of Prompting

  • Zero-shot Prompting 无样本
  • Few-shot Prompting 少样本
  • Chain-of-Thought Prompting
  • Self-Consistency
  • Tree of Thoughts
  • Multimodal CoT Prompting
  • Active-Prompt
  • Generate Knowledge Prompting
  • Retrieval Augmented Generation
  • Automatic Reasoning and Tool-use