When we say zero-shot or few-shot, it just the way we provide prompts when use GPT models, such as GPT3, GPT4 or chatGPT.
Performance wise, always start with zero-shot, then few-shot (example), neither of them worked, then fine-tune.
So what’s zero-shot prompt? Here is one example:
Extract keywords from the below text. |
If the performance is not good, try to add few examples in the prompt, this is so called few-shot learning.
Extract keywords from the corresponding texts below. |
Sometimes even with few shot examples, performance might be still not what you expect, so try to use fine tuning.
But notice that, as the GPT model get more and more powerful, OpenAI will expect people to use the base model more and less fine tune, so support on the fine tune side might be less in the future.
The resource from OpenAI about how to do fine tune is here:
fine tune instruction
fine tune code example
For the model parameters, Generally, OpenAI recommend model and temperature are the most commonly used parameters to alter the model output.
model - Higher performance models are more expensive and have higher latency.
temperature - A measure of how often the model outputs a less likely token. The higher the temperature, the more random (and usually creative) the output. This, however, is not the same as “truthfulness”. For most factual use cases such as data extraction, and truthful Q&A, the temperature of 0 is best.
max_tokens (maximum length) - Does not control the length of the output, but a hard cutoff limit for token generation. Ideally you won’t hit this limit often, as your model will stop either when it thinks it’s finished, or when it hits a stop sequence you defined.
stop (stop sequences) - A set of characters (tokens) that, when generated, will cause the text generation to stop.
More information about OpenAI API reference can be found here
OpenAI API reference