Example

Example of a Few-Shot Prompt for a Mathematical Reasoning Task

A few-shot prompt can be used to guide a Large Language Model through a mathematical reasoning task by providing several demonstrations that establish a pattern. For instance, to teach a model to sum two numbers and divide by their product, the following examples could be used:

DEMO

  • 12  5(12+5)/(12×5)=0.283{}12\ \ 5 \rightarrow (12 + 5)/(12 \times 5) = 0.283
  • 3  1(3+1)/(3×1)=1.33{}3\ \ 1 \rightarrow (3 + 1)/(3 \times 1) = 1.33
  • 9  4(9+4)/(9×4)=0.138{}-9\ \ 4 \rightarrow (-9 + 4)/(-9 \times 4) = 0.138
  • 15  15(15+15)/(15×15)=0.133{}15\ \ 15 \rightarrow (15 + 15)/(15 \times 15) = 0.133

USER

  • 19  73{}19\ \ 73 \rightarrow

This structure allows the model to infer the required operation for the new input pair.

Image 0

0

1

Updated 2026-04-29

Contributors are:

Who are from:

Tags

Ch.3 Prompting - Foundations of Large Language Models

Foundations of Large Language Models

Foundations of Large Language Models Course

Computing Sciences