liveBook · Manning

One-shot learning

As explained in Fight Fraud with Machine Learning

One-shot learning is a learning setting in which a model must recognize or learn a new pattern from a single example.

One-shot learning enables a model to recognize a new pattern from one example or a very small number of examples. In phishing detection, prompt engineering can show ChatGPT one genuine email and one phishing email before asking it to classify another message. section 5.2.4 section 4.3

The technique is useful when a new pattern is too rare or specific to justify retraining a model from scratch:

  • Provide representative examples of the target pattern in the prompt. section 5.2.4
  • Ask the model to classify a new input using the demonstrated distinction. section 5.2.4
  • Use Siamese networks when the system must learn new patterns from one or a few similar samples without full retraining. section 4.3

Teaching a phishing pattern

ChatGPT initially treats an email from a ghost domain as genuine because it has not encountered that website pattern. Supplying a genuine email and a phishing email in the prompt lets it correctly identify the previously misclassified message. The same workflow can return a classification, confidence score, and explanation through an application using the ChatGPT API. section 5.2.4

Figure 5.18 One-shot prompting to teach ChatGPT to catch a particular kind of phishing email from a specific domain.

Shows the one-shot prompt structure for teaching ChatGPT to detect a particular phishing pattern from a specific domain. section 5.2.4

How Fight Fraud with Machine Learning covers it

How deep it goes
Defines one-shot and few-shot learning, demonstrates prompt-based correction, and names Siamese networks without detailing their implementation.
Examples
Uses a misclassified phishing email, a genuine-and-phishing demonstration pair, and a specific ghost-domain pattern.
What you can do after
Apply it via prompt engineering to classify phishing emails after supplying representative genuine and phishing examples.
How it connects
Connects one-shot learning with prompt engineering, phishing detection, few-shot learning, large language models, and Siamese networks.

Also explained in

Compare how 2 books explain one-shot learning →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Fight Fraud with Machine Learning. The section links point to the parts of the book it draws on.