From Prompt Engineering by Lilian Weng
Also known as In-Context Prompting
How to communicate with LLM to steer its behavior for desired outcomes without updating the model weights.
It is an empirical task (science?) and varies among models.
Zero-shot: Feed the task text to the model and ask for results.
Few-shot: Input/output of high quality examples on the target task.
task instruction
, input
, ground truth output
)Instruction prompting
temperature > 0
and select the best.
Let's think step by step
Input
: prompt (sequence of prefix tokens).
Optimization task
: probability of getting a desired output given input.
How?
Prefix tokens are optimized on the embedding space via gradient descent
Multiple methods: AutoPrompt (Shin et al., 2020), Prefix-Tuning (Li & Liang (2021), P-tuning (Liu et al. 2021), Prompt-Tuning (Lester et al. 2021).
APE (Automatic Prompt Engineer; Zhou et al. 2022): It uses a score function to select the best candidate over a pool of model-generated instruction candidates.
PoT