When AI doesn’t work, give it an example
Writing a working AI prompt doesn’t need to be annoying.
How often did you complain that AI gets worse because it ignores your instructions? No matter what you write, it always makes a mistake.
Show, don’t tell. Stop describing the outcome you need. It’s sufficient to describe a general idea to point a direction and provide examples to clarify the details:
Do you need to classify a text? Tell AI to classify the text as X, Y, or Z and provide at least one example for each class. Are you summarizing a text? Provide an example of what AI should retain in a summary and what isn’t important.
Providing an example has an additional benefit. You must know what you want. Often, when AI “doesn’t work,” we expect it to guess what we need because we don’t know it ourselves.
“I know it when I see it” never works.
As with everything in machine learning, the simple idea of giving AI some examples has a fancy name: in-context learning. Depending on how many examples you provide, it may be a one-shot in-context learning or a few-shot in-context learning. You may need to know it during a job interview… and never again.
See this post on X or LinkedIn.Published on: 21 Feb 2024