Explains that few-shot examples in prompts steer LLMs’ output format, tone, and behavior via in-context learning without changing model weights or reducing inference cost.
Question 6.In prompt engineering for LLMs, what is the primary purpose of using few-shot examples?
To increase the model’s vocabulary?
To guide the model’s response format and style?
To reduce the computational cost of inference?
Or to fine-tune the model weights in real time?
Answer: Few-shot — To guide the model’s response format and style.Few-shot examples supply in-context demonstrations that steer the LLM toward the expected format, tone, and approach for a task. They do not alter the model’s internal weights or vocabulary and do not reduce inference cost. Instead, they provide examples that the model uses at inference time to infer the desired mapping from inputs to outputs.
ExampleThe following few-shot prompt gives the model three demonstration pairs that map plain-English instructions to shell commands. The fourth entry is the new instruction (the query). The model should follow the demonstrated pattern and produce the corresponding command:
# Example few-shot prompt: instruction -> command pairsInstruction: List files in the current directoryCommand: lsInstruction: Show the current working directoryCommand: pwdInstruction: Create a directory named projectsCommand: mkdir projects# Target query (model should infer the pattern and respond with a command)Instruction: Remove the file old.txtCommand:
Given those demonstrations, the model should infer the mapping from “Instruction” to “Command” and complete the last “Command” with the correct shell command, for example:
rm old.txt
Few-shot prompts provide examples that shape the model’s output format and style at inference time. They do not train the model or change its weights; they simply bias the model toward the pattern shown in the prompt.
Quick comparison
Option
What it does
Correct?
Increase the model’s vocabulary
Not affected by few-shot prompts; vocabulary is defined by the pre-trained model
No
Guide the model’s response format and style
Provides in-context examples so the model mimics the demonstrated structure and tone
Yes
Reduce computational cost of inference
Few-shot examples can increase prompt length and cost per query rather than reduce it
No
Fine-tune model weights in real time
Few-shot prompting is not training; it does not update model parameters